Results 1 to 6 of 6
- 07-07-2009, 05:16 PM #1
Member
- Join Date
- Dec 2008
- Posts
- 99
- Rep Power
- 0
-
You should create a JDialog and display it in a non-modal fashion. You can do this either by creating a JOptionPane and extracting a JDialog from this (the API will tell you how) or by creating a JDialog de-novo, which is quite similar to creating a JFrame. Again, the API will show you the constructors.
- 07-28-2009, 01:51 PM #3
You should use your own JDialog and use it as non-modal.
The easiest way is to create a JOptionPane and add it to a non-modial JDialog:
Hope it helps.Java Code:JDialog dialog = new JDialog(frame, false); // Sets its owner but makes it non-modal JOptionPane optionPane = new JOptionPane("Message"); // Same arguments as in JOptionPane.showMessageDialog(...) dialog.getContentPane().add(optionPane); // Adds the JOptionPane to the dialog dialog.pack(); // Packs the dialog so that the JOptionPane can be seen dialog.setVisible(true); // Shows the dialogLast edited by josemoncas; 07-28-2009 at 01:53 PM.
The web that offers Java utilities (classes) which make programming Swing applications an easier task: JMC Java utilities
- 07-28-2009, 04:26 PM #4
Member
- Join Date
- Dec 2008
- Posts
- 99
- Rep Power
- 0
thanks
it helpedYou should use your own JDialog and use it as non-modal.
The easiest way is to create a JOptionPane and add it to a non-modial JDialog:
-
The reason I recommended inspecting the API is that there's an even easier way of creating a JDialog from a JOptionPane, one that creates the dialog directly from the JOptionPane using its createDialog method:
Java Code:// assuming a JFrame called frame... JOptionPane optionPane = new JOptionPane("Message"); JDialog myDialog = optionPane.createDialog(frame, "Dialog Title"); myDialog.setModal(false); myDialog.setVisible(true);
- 07-29-2009, 06:38 PM #6
No conocía esa forma :)
Algo nuevo pa'l librito :PThe web that offers Java utilities (classes) which make programming Swing applications an easier task: JMC Java utilities
Similar Threads
-
help with JOptionPane.showMessageDialog()
By gmn1 in forum New To JavaReplies: 8Last Post: 03-30-2009, 09:31 AM -
Sick of duplicating JOptionPane.showMessageDialog
By gdanelian in forum New To JavaReplies: 2Last Post: 11-18-2008, 05:53 PM -
No meesage display for JOptionPane.showMessageDialog in VnC or Solaris
By quest4qwerty in forum AWT / SwingReplies: 1Last Post: 10-29-2008, 07:50 AM -
About JOptionPane.showMessageDialog
By jhetfield18 in forum AWT / SwingReplies: 2Last Post: 11-02-2007, 10:45 PM -
About JOptionPane.showMessageDialog
By jhetfield18 in forum Advanced JavaReplies: 0Last Post: 11-02-2007, 10:56 AM


LinkBack URL
About LinkBacks


Bookmarks