Swing (javax.swing)

Creating an Internal Frame


    boolean resizable = true;
    boolean closeable = true;
    boolean maximizable  = true;
    boolean iconifiable = true;
    int width = 200;
    int height = 50;
    JInternalFrame iframe = new JInternalFrame("",
	 resizable, closeable, maximizable, iconifiable);
    iframe.setSize(width, height);
    
    // Add component to internal frame.
    
    // Add internal frame to desktop.
    JDesktopPane desktop = new JDesktopPane();
    desktop.add(iframe);


// eigen voorbeeld => import java.awt.*; import java.awt.event.*; import javax.swing.*; class ExampleInternalFrames extends JFrame{ ExampleInternalFrames( ){ // call super JFrame instance super("Voorbeeld internal frames"); // get frame container Container FRAMECONTAINER = getContentPane( ); // create desktop JDesktopPane DESKTOPPANE = new JDesktopPane( ); // add desktop to container FRAMECONTAINER.add(DESKTOPPANE ); // create panel JPanel PANEL = new JPanel( ); // create internal frame to place PANEL (via desktop) JInternalFrame INTERNALFRAME = new JInternalFrame("an internal frame", true,true, true, true); // position and size internal frame INTERNALFRAME.setLocation(0,0); INTERNALFRAME.setSize(200,100); // add internal frame to desktoppane DESKTOPPANE.add( INTERNALFRAME ); setSize(400, 300); setVisible(true ); }// end of constructor public static void main(String args[]){ new ExampleInternalFrames( );} }