• Post Reply Bookmark Topic Watch Topic
  • New Topic

GUI - How to make a Class modal under another class  RSS feed

 
Jonathan Bjerche
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question is: How can I make the Jframe/Jdialog window modal over the Jframe/Jdialog window of another class?

Ex:
Lets say I have 2 GUI classes that each represents a window with lots of buttons etc..

When I click on a button of GUI class 1's window, GUI class 2 comes up with its window.

How can I make GUI class 2's window modal over GUI class 1's window? (So that GUI class 1's window can't be clicked when GUI class 2's window is open)
 
Panagiotis Kalogeropoulos
Rancher
Posts: 99
Java Netbeans IDE
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could instantiate a JDialog as the second window and make it modal, either by using its constructor or its setModal method.

Check the api of the JDialog:
http://docs.oracle.com/javase/6/docs/api/javax/swing/JDialog.html
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!