• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with my JFrame; JFrame not closing

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Here is my code::

 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

What is Classroomdetails
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
mithesh raj
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
mithesh raj
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For the "Save" button, its working.

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.

Please help me.

 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have already been provided help:

Ranganathan Kaliyur Mannar wrote:You have too many frames.


Maneesh Godbole wrote:For switching UI screens, I would recommend something like a CardLayout



So, use only one main frame and use CardLayout to switch screens. Make these changes and if you run into problems, let us know.
 
money grubbing section goes here:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic