Module java.desktop
Package javax.swing

Class JInternalFrame

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

@JavaBean(defaultProperty="JMenuBar",
          description="A frame container which is contained within another window.")
public class JInternalFrame
extends JComponent
implements Accessible, WindowConstants, RootPaneContainer
A lightweight object that provides many of the features of a native frame, including dragging, closing, becoming an icon, resizing, title display, and support for a menu bar. For task-oriented documentation and examples of using internal frames, see How to Use Internal Frames, a section in The Java Tutorial.

Generally, you add JInternalFrames to a JDesktopPane. The UI delegates the look-and-feel-specific actions to the DesktopManager object maintained by the JDesktopPane.

The JInternalFrame content pane is where you add child components. As a convenience, the add, remove, and setLayout methods of this class are overridden, so that they delegate calls to the corresponding methods of the ContentPane. For example, you can add a child component to an internal frame as follows:

       internalFrame.add(child);
 
And the child will be added to the contentPane. The content pane is actually managed by an instance of JRootPane, which also manages a layout pane, glass pane, and optional menu bar for the internal frame. Please see the JRootPane documentation for a complete description of these components. Refer to RootPaneContainer for details on adding, removing and setting the LayoutManager of a JInternalFrame.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Since:
1.2
See Also:
InternalFrameEvent, JDesktopPane, DesktopManager, JInternalFrame.JDesktopIcon, JRootPane, RootPaneContainer
  • Field Details

  • Constructor Details

    • JInternalFrame

      public JInternalFrame()
      Creates a non-resizable, non-closable, non-maximizable, non-iconifiable JInternalFrame with no title.
    • JInternalFrame

      public JInternalFrame​(String title)
      Creates a non-resizable, non-closable, non-maximizable, non-iconifiable JInternalFrame with the specified title. Note that passing in a null title results in unspecified behavior and possibly an exception.
      Parameters:
      title - the non-null String to display in the title bar
    • JInternalFrame

      public JInternalFrame​(String title, boolean resizable)
      Creates a non-closable, non-maximizable, non-iconifiable JInternalFrame with the specified title and resizability.
      Parameters:
      title - the String to display in the title bar
      resizable - if true, the internal frame can be resized
    • JInternalFrame

      public JInternalFrame​(String title, boolean resizable, boolean closable)
      Creates a non-maximizable, non-iconifiable JInternalFrame with the specified title, resizability, and closability.
      Parameters:
      title - the String to display in the title bar
      resizable - if true, the internal frame can be resized
      closable - if true, the internal frame can be closed
    • JInternalFrame

      public JInternalFrame​(String title, boolean resizable, boolean closable, boolean maximizable)
      Creates a non-iconifiable JInternalFrame with the specified title, resizability, closability, and maximizability.
      Parameters:
      title - the String to display in the title bar
      resizable - if true, the internal frame can be resized
      closable - if true, the internal frame can be closed
      maximizable - if true, the internal frame can be maximized
    • JInternalFrame

      public JInternalFrame​(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable)
      Creates a JInternalFrame with the specified title, resizability, closability, maximizability, and iconifiability. All JInternalFrame constructors use this one.
      Parameters:
      title - the String to display in the title bar
      resizable - if true, the internal frame can be resized
      closable - if true, the internal frame can be closed
      maximizable - if true, the internal frame can be maximized
      iconifiable - if true, the internal frame can be iconified
  • Method Details