Re: help with inserting an internal frame into a tabbed pane
Justin schrieb:
Id like a tab where the user can view and move around multiple windows
at the same time.
Ok, to use JInternalFrame you best add them to a JDesktopPane. The
following example shows a desktop within a tab page that contains two
internal frames: one that is resizable and closable and one that is
iconifiable.
import javax.swing.*;
public class Test {
public static final void main( String args[] ) {
JDesktopPane desktop = new JDesktopPane();
desktop.setPreferredSize( new java.awt.Dimension(600,400) );
JInternalFrame iframe = new JInternalFrame("First Frame");
iframe.setSize( 200, 100 );
iframe.setVisible( true );
iframe.setResizable( true );
iframe.setClosable( true );
desktop.add( iframe );
iframe = new JInternalFrame("Second Frame");
iframe.setSize( 200, 100 );
iframe.setLocation( 200, 200 );
iframe.setVisible( true );
iframe.setIconifiable( true );
desktop.add( iframe );
JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.addTab( "Desktop", desktop );
JFrame frame = new JFrame( "Test ");
frame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
frame.setContentPane( tabbedPane );
frame.pack();
frame.setVisible(true);
}
}
Bye
Michael