I edited your post to use Code Tags. Unfortunately, your post didn't have indentation, so that wasn't preserved, but at least you have line numbers now. I didn't see any bold, so perhaps you can direct us to specific lines...?
(Posting code is helpful, but you're more likely to get useful responses if you keep your post brief and to the point. Perhaps there's some way to reduce your question to a general case?)
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
marc weber wrote:(Posting code is helpful, but you're more likely to get useful responses if you keep your post brief and to the point. Perhaps there's some way to reduce your question to a general case?)
Right. We prefer an SSCCE instead of almost 700 lines of code. To be honest, the length of code combined with the lack of indentation made me skip over it completely.
marc, thanks for the aid to put it into a code tag whatever it means.
basically this is my assignment from my school which requires me to create an application for a student registration program.
i dun really know much of java swing programming so i put the code together using youtube, google and other source as my research source.
to be brief, the desire result is that i had a menu bar with menu item. when i click on the enroll new student menu item, it suppose to go to a pop up window which in this case i use a new frame . on the new window, there are some textfield that allow user to input data and then when i click submit, i wish to use the input from user to create a text file and then store the other textfield input in the text file.
what i facing now is that when i click on the menu item enroll new student, it create a text file with the text that i put as the default text without i clicking the submit button.
michael , i did post on multiple forum to get the maximum reply to my problem. how sure are you that it is not my code? if its not my code, why would i post code that is not working to get it working? it fine if you do not wish to help , but please to do not generalize people posting on multi forum asking for help. although i thank you for your input even though it is useless.
There're several 'problems' in your code. The specific one you're asking for is located in your ActionListener implementation 'submitNewEnroll' (you should consider following the Naming Conventions).
When you instantiate the class and add it as ActionListener for the submit button, the textfield has the default content (preallocated). You create a file on construction time of 'submitNewEnroll' and do nothing on a button click (method actionPerformed() is empty). You should read the content of your textfield in your 'actionPerfomed()' method and also create the file there. That's the whole point of using an ActionListener ... do do something in the actionPerformed() method, don't you think?
Censorship is the younger of two shameful sisters, the older one bears the name inquisition. -- Johann Nepomuk Nestroy
Afraid nobody will go through all that code to try and find the problem. The idea behind a school assignment is that you do the work, and ask for help on specific parts. [See Ranch Office thread]
You will need to read the link which appears against SSCCE ← like that, so you can work out what to post. You would do better to create a small example which reads the student's name from a JOptionPane (input dialog) and writes it to the file. Then you can add to it gradually. You should also not try to compile 700 lines of code all at once; you should run your application every time you add 7 lines of code; then you can see it working in parts.
[See Ranch Office thread]
Joined: Jun 15, 2010
[See Ranch Office Thread]
Joined: Jun 09, 2003
[See Ranch Office thread.]
Joined: Oct 13, 2005
I think at this point, I shall be obliged to transfer this thread; I shall duplicate it to the Ranch Office forum, where discussion about posting in several places should continue, please.
Joined: Oct 13, 2005
I earlier wrote:I think at this point, I shall be obliged to transfer this thread; I shall duplicate it to the Ranch Office forum, where discussion about posting in several places should continue, please.