• Post Reply Bookmark Topic Watch Topic
  • New Topic

Check the JFrame is opened already or not

 
Aravind Prasad
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Ranchers,
I'm doing a project in Java Swings and MySQL. I'm using Menus for the project. In the first menu, When the action is occured it is opening a new window. I'm using the new child window "always on top". But when i tried to open it again, it is opening.
Can i do a if condition to check
whether the child window is opened or no

Please help me ranchers

Thanks in advance

regards
Aravind Prasad
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just don't create a new frame - have one reference to the frame (either as a singleton or just as a variable in your class) and call setVisible(true) and setVisible(false) on it instead of creating new frame references every time.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!