Reputation: 1267
What I want is to make a new JFrame, keeping my current JFrame visible, but not create a new window/program. I can't explain it well, so here is a picture of what I mean:
http://screensnapr.com/e/mkCMlm.png
Sorry if this is confusing in any way. Any help is appreciated.
Upvotes: 0
Views: 2296
Reputation: 6813
If I understood correctly you want JInternalFrame which are a special component in swing that live inside a Container named Desktop. So if you want to have a behaviour like this:
You definitely need to have inside your JFrame a container named JDesktopPane, then you can add JInternalFrame inside this container like this:
MyInternalFrame frame = new MyInternalFrame();
frame.setVisible(true);
desktop.add(frame);
try {
frame.setSelected(true);
} catch (java.beans.PropertyVetoException e) {ex.printStackTrace();}
For more information you can see official oracle documentation or Java2SE code samples
Upvotes: 2
Reputation: 9307
You can try http://docs.oracle.com/javase/tutorial/uiswing/components/internalframe.html
Also you can try to use a dialog rather than frame for the new window.
Upvotes: 5