Creating a JDesktopPane Container : MDI « Swing JFC « Java






Creating a JDesktopPane Container

 

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);
  }
}

   
  








Related examples in the same category

1.Dynamic menu item for MDI children window and scroll barDynamic menu item for MDI children window and scroll bar
2.Getting All Frames in a JDesktopPane Container
3.Create a virtual desktop in your application
4.Build multiple document interface by yourselfBuild multiple document interface by yourself