   Java dialogs
  I am having a very difficult time understanding the implementation of dialogs in Java applets. My applet makes use of them in many areas, such as responding to a MenuItem selection, as well as responding to events generated by other controls.The (dialog) API Specifications off of Sun's website are a hellish myriad of confusion and I can't follow their examples.Say I have a Menu named "Filed", and a MenuItem from File named "New". And I want a dialog to be initialized to screen when New is selected.JDialog newDialog = new JDialog(this,"New"); // 'this' is the JAppletJLabel boring = new JLabel("I am just hangin' out doin nodda.");newDialog.add(boring);Where do I go from here? What listener funtions catch events generated by MenuItem selections? Within these functions, how do I bring the dialog up to screen? Does my dialog need its own plethora of listeners, separate from that of the JApplet's?I am so confused.   :-/   
  I'm pretty sure my explanation will help your problem although I am rather Java illiterate (doing some beginner classes in school) so it may not be exactly what you need.First of all you will need this at the top:import javax.swing.*;After that you can have windows displaying text using this code:JOptionPane.showMessageDialog(null, "Here is the text", "Here is the title of the window", INFORMATIVE_MESSAGE);JOptionPane.showInputDialog("Please enter a number: ");I think that is relatively easy to understand but the null in the first one is what type of frame is on the window (from my understanding).  There is also many other things you can do with it too, just google it.   ;  The JOptionPane class is quite helpfull and configurable for many types of dialog, input and message boxes.You can't add any listeners to it, but they do return values when they are closed (different values for OK button, cancel etc.)   ;  To make something pop up when you select the menu item, attach a java.awt.event.ActionListener to it. In that listener's actionPerformed method, show the dialog.Obviously, if you want the dialog to do something, you'll need to add controls (and listeners for those controls) to it. Also, you will probably want to use the setDefaultCloseOperation method in JDialog so that you can close your dialog without having to attach a WindowListener to it (the default behaviour of the X in the top right corner of the dialog is to just do nothing).IIRC, it isn't possible to use a JApplet as a parent for a dialog (i.e. the first parameter of the JDialog constructor). According to a javap on javax.swing.JDialog, you can only use a Dialog or Frame as a parent.Edit: Oh yeah, just noticed the code you're using to add things to your dialog. You should use getContentPane().add rather than just plain add. IIRC it makes no difference on Java 5.0, but will break on versions before it.   