Jackson, Doug wrote:
Does anyone know how to make a separate JPanel or Window and call it from an
application.
I need to make a separate pop-up window with info while keeping the original
screen it was
called from the same. I need to do this in swing. Can anybody help?
Thanks in advance.
I'm not sure I quite understand your question, but if you need one of
the "standard" modal dialogs, you can use the static methods on
JOptionPane. If you need a more complex modal dialog, a non-modal
dialog or just a completely separate non-dialog type window, you can
construct a JDialog or JFrame as follows:
JFrame frame = new JFrame( "Title here" );
frame.getContentPane().setLayout( ... );
frame.getContentPane().add( ... );
frame.setVisible( true );
A JDialog is much the same as a JFrame except that it can be modal, and
it doesn't show up in the list of windows (e.g. in your Windows taskbar
or [I think] GNOME panel). It's considered kind of a sub-window,
whereas a JFrame is a proper top-level window. In order to get rid of a
dialog, especially a modal one, call the dispose() method.
Hope this is what you were looking for!
- Eric
|