Hi to all,
I am having problem with my JFrame.
When I click on "Back" button, the classroom details menu appears but the classroom input JFrame stays in the background.
Please help me to correct it.
In future, while posting code, please UseCodeTags I have added them this time for you. As you can see the tags make the code much more easier to read and understand
You are having 2 frames in your code. Do you know which one you are closing?
The ActionListener is an inner class and you are calling dispose() which means the addclassroom frame is closed. Is that your intent?
Btw, the class name 'addclassroom' is a poor name. You should try and follow some coding conventions.
Also, you are having a common ActionListener in which you are checking the 'text' of the buttons and doing stuff. This is again not a great way of coding ActionListeners.
sorry about the naming conventions....... "addclassroom" is the name of this input form.... When I click on the "Back" button, it should close "addclassroom" to open "Classroomdetails". But this is not the case.
Again when I click on "Save" button...a new form appears while the other one still remains on the background.
Only one form should appear at a time.
I am having problem with both "Save" and "Back" button. Please help me friends.
You have too many frames. You also have a ciFrame which is made visible and the "addclassroom" itself extends frame. You have also not told us about Classroomdetails.
You should have only one main frame and rest should be dialogs (JDialog).
Dialogs should (typically) be used for additional operations and/or input related to the parent form. For switching UI screens, I would recommend something like a CardLayout
But I am still having problem with "Back" button... the "Classroomdetails" , which is a sub menu, appears...however the "addclassroom" form still remains in the background.