This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am currently working on a small program to freshen up on some introductory Java and prepare for my Java class coming up later in my Bach program. I chose to create a small program to keep track of data.
The program opens with a window displaying the current date and a calendar with selectable buttons for each day. When the button is clicked for that day, it opens up a new window. The new window is where the information is to be entered. The problem I am having is with the Submit button and trying to figure out how to make it close the window (or hide it or dispose it).
I have done some research but everything I found shows information about WindowListeners to show how the close button on the frames work and I don't think that will work with this particular scenario, unless I'm just not fully understanding it which is very possible.
Here is the code I have:
The underlined "frame" is where the problem is.
I think I understand why it isn't working, but I haven't been able to figure out how to make it work. I am new to Java and it has been seven months since my Java I class that didn't cover any Swing concepts so I'm a bit stuck. The program works fine at the moment but you have to hit the X button on the Frame to close/hide the frame after you hit the submit button. I have purchased Swing A Beginner's Guide by Herbert Schildt to help me out with the GUI programming but there isn't any mention of this issue in the book or implementation of it in any of the modules.
Any help would be appreciated. A link to a reference or perhaps some first hand experience you have with this issue would be great! I could put that cancel button back on the window. Until then I'll keep on keeping on .