In this section, you will learn how to create a desktop pane container in Java.
Create a Desktop Pane Container in Java
In this section, you will learn how to create a desktop pane container in Java. The desktop pane container is a container, which has the internal frame. This internal frame has the same feature as like a frame. The desktop pane is like a MDI (Multiple Document Interface) frame and all internal frames are like the child frame for the main frame. All internal frames open under the desktop pane. Following figure shows the JDesktopPane component of Java Swing:
This program shows the internal frame inside the MDI frame. The internal frame has two command buttons: Ok and Cancel. This frame has the minimize, maximize and close buttons that provides the minimize (iconify), maximize and the close operations. Buttons on the internal frame have the tool tip text. Following methods and APIs have been used in the given program for getting the desktop pane container:
JInternalFrame(String iframe_title, Boolean resizable, Boolean closable, Boolean maximizable, Boolean minimizable ):
This is the constructor of JInternalFrame class. It extends from the JComponent. This constructor has been used to create a new internal frame. This constructor takes some argument as follow:
- First is the title of the internal frame which has to be shown in the desktop pane.
- Second is the boolean value either true or false which determines the frame should be resizable or not.
- Third is also a boolean value true or false which determines the frame should be closable or not.
- Fourth is also a boolean value true or false which determines the frame should be maximize or not.
- And last is also a boolean value which determines for the iconifying.
This is the class which creates a desktop pane like MDI (Multiple Document Interface).
Here is the code of program: