Creating a JDesktopPane Container : JDesktopPane « Swing « Java Tutorial






import java.awt.BorderLayout;

import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JTextArea;

public class Main {
  public static void main(String[] argv) throws Exception {
    boolean resizable = true;
    boolean closeable = true;
    boolean maximizable = true;
    boolean iconifiable = true;
    String title = "Frame Title";
    JInternalFrame iframe = new JInternalFrame(title, resizable, closeable, maximizable,
        iconifiable);

    iframe.setSize(300, 300);
    iframe.setVisible(true);
    iframe.getContentPane().add(new JTextArea());
    JDesktopPane desktop = new JDesktopPane();
    desktop.add(iframe);

    JFrame frame = new JFrame();
    frame.getContentPane().add(desktop, BorderLayout.CENTER);
    frame.setSize(300, 300);
    frame.setVisible(true);
  }
}








14.54.JDesktopPane
14.54.1.JDesktopPane is a specialized JLayeredPane.
14.54.2.Adding Internal Frames to a JDesktopPaneAdding Internal Frames to a JDesktopPane
14.54.3.JDesktopPane.PALETTE_LAYERJDesktopPane.PALETTE_LAYER
14.54.4.extends JDesktopPane implements Scrollable
14.54.5.Getting All Frames in a JDesktopPane Container
14.54.6.Creating a JDesktopPane Container
14.54.7.Create a virtual desktop in your application
14.54.8.Customizing a JDesktopPane Look and Feel