JDialog : Java Glossary

home page J words local find full screen, hide local find menu Google search web for more information on this topic jump to foot of page translate this page with Babelfish punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all) ©1996-2010 2006-02-02 Roedy Green, Canadian Mind Products
JDialog
JDialogs are a type of Window that pop up over a parent JFrame, usually to ask the user to confirm something or display an About box. JDialogs can be modal or non-modal. Modal JDialogs monopolise the user’s attention, preventing him from clicking anywhere but in the jdialog box.

For simple questions, you can use JOptionPane.showInputDialog which comes in two versions, one that just prompts for a String and one that selects an item from a list.

Dialog is the AWT equivalent of JDialog.

Gotchas Learning More
Sample Code Links

Gotchas

JDialog constructors want a Frame/JFrame as parent. Unfortunately, JApplet is an Applet, which is a Panel, not a Frame. To embed a JDialog in an Applet, you must chase the Component.getParent chain until you find an instanceof Frame. Alternatively, you can pop up a new JFrame for the JDialog to live in.

If JDialogs fail to paint anything, it could be because you forgot to do a setSize, validate(), or setVisible( true ). JDialog.setBackground does not work. Use jdialog.getContentPane().add( child );

Sample Code

Learning More

Sun’s Javadoc on JDialog class : available:

CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/jdialog.html J:\mindprod\jgloss\jdialog.html
CMP logofeedback Please email your feedback for publication, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.191.113]
You are visitor number 35,357.