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 javax.swing.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 java..
InternalFrameEvent, JDesktopPane, DesktopManager, JInternalFrame.JDesktopIcon , JRootPane, javax.swing.RootPaneContainer
| Modifier and Type | Class and Description |
|---|---|
| protected class | JInternalFrame.
This class implements accessibility support for the
|
| private static class | |
| public static class | JInternalFrame.
This component represents an iconified version of a
|
| Modifier and Type | Field and Description |
|---|---|
| protected boolean | closable
The frame can be closed. |
| public static final String | CONTENT_PANE_PROPERTY
Bound property name. |
| pack-priv boolean | |
| private int | |
| protected JInternalFrame. | desktopIcon
The icon that is displayed when this internal frame is iconified. |
| private static PropertyChangeListener | |
| public static final String | FRAME_ICON_PROPERTY
Bound property name. |
| protected Icon | frameIcon
The icon shown in the top-left corner of this internal frame. |
| public static final String | GLASS_PANE_PROPERTY
Bound property name. |
| protected boolean | iconable
The frame can "iconified" (shrunk down and displayed as an icon-image). |
| public static final String | IS_CLOSED_PROPERTY
Constrained property name indicating that the internal frame is closed. |
| public static final String | IS_ICON_PROPERTY
Constrained property name indicating that the internal frame is iconified. |
| public static final String | IS_MAXIMUM_PROPERTY
Constrained property name indicating that the internal frame is maximized. |
| public static final String | IS_SELECTED_PROPERTY
Constrained property name indicated that this frame has selected status. |
| protected boolean | isClosed
The frame has been closed. |
| pack-priv boolean | |
| protected boolean | isIcon
The frame has been iconified. |
| protected boolean | isMaximum
The frame has been expanded to its maximum size. |
| protected boolean | isSelected
The frame is currently selected. |
| private Cursor | |
| private Component | lastFocusOwner
Contains the Component that focus is to go when
|
| public static final String | LAYERED_PANE_PROPERTY
Bound property name. |
| protected boolean | maximizable
The frame can be expanded to the size of the desktop pane. |
| public static final String | MENU_BAR_PROPERTY
Bound property name. |
| private Rectangle | |
| private boolean | |
| protected boolean | resizable
The frame's size can be changed. |
| public static final String | ROOT_PANE_PROPERTY
Bound property name. |
| protected JRootPane | rootPane
The |
| protected boolean | rootPaneCheckingEnabled
If true then calls to |
| protected String | title
The title displayed in this internal frame's title bar. |
| public static final String | TITLE_PROPERTY
Bound property name. |
| private static final String |
| Access | Constructor and Description |
|---|---|
| public | JInternalFrame()
Creates a non-resizable, non-closable, non-maximizable,
non-iconifiable |
| public | JInternalFrame(String
the non- title)null String
to display in the title barCreates a non-resizable, non-closable, non-maximizable,
non-iconifiable |
| public | JInternalFrame(String
the title, boolean String to display in the title barif resizable)true, the internal frame can be resizedCreates a non-closable, non-maximizable, non-iconifiable
|
| public | JInternalFrame(String
the title, boolean String to display in the title barif resizable, boolean true, the internal frame can be resizedif closable)true, the internal frame can be closedCreates a non-maximizable, non-iconifiable |
| public | JInternalFrame(String
the title, boolean String to display in the title barif resizable, boolean true, the internal frame can be resizedif closable, boolean true, the internal frame can be closedif maximizable)true, the internal frame can be maximizedCreates a non-iconifiable |
| public | JInternalFrame(String
the title, boolean String to display in the title barif resizable, boolean true, the internal frame can be resizedif closable, boolean true, the internal frame can be closedif maximizable, boolean true, the internal frame can be maximizedif iconifiable)true, the internal frame can be iconifiedCreates a |
| Modifier and Type | Method and Description |
|---|---|
| protected void | addImpl(Component
the component to be enhanced comp, Object the constraints to be respected constraints, int the index index)Overrides java. Adds the specified child |
| public void | addInternalFrameListener(InternalFrameListener
the internal frame listener l)Adds the specified listener to receive internal frame events from this internal frame. |
| private static void | |
| pack-priv void | compWriteObjectNotify()
Overrides javax. This is called from Component by way of reflection. |
| protected JRootPane | |
| public void | |
| public void | doDefaultCloseAction()
Fires an
|
| protected void | fireInternalFrameEvent(int
the type of the event being fired; one of the following:
id)
Fires an internal frame event. |
| public AccessibleContext | Returns: anAccessibleJInternalFrame that serves as the
AccessibleContext of this
JInternalFrameOverrides java. Implements javax. Gets the |
| public Container | Returns: the content paneImplements javax. Returns the content pane for this internal frame. |
| public int | Returns: the operation that will occur when the user closes the internal frameReturns the default operation that occurs when the user initiates a "close" on this internal frame. |
| public JInternalFrame. | Returns: theJDesktopIcon displayed on the desktopReturns the |
| public JDesktopPane | Returns: theJDesktopPane this internal frame belongs to,
or null if none is foundConvenience method that searches the ancestor hierarchy for a
|
| public final Container | Returns: nullOverrides java. Always returns |
| public Component | Returns: the component with focus, ornull if no children have focusIf this |
| public Icon | Returns: theIcon displayed in the title barReturns the image displayed in the title bar of this internal frame (usually in the top-left corner). |
| public Component | Returns: the glass paneImplements javax. Returns the glass pane for this internal frame. |
| public InternalFrameListener[] | Returns: all of theInternalFrameListeners added or an empty
array if no listeners have been addedReturns an array of all the |
| public JMenuBar | Returns: theJMenuBar used by this internal frameReturns the current |
| public Cursor | Returns: the last non-resizableCursorReturns the last |
| public int | Returns: anInteger object specifying this
frame's desktop layerConvenience method for getting the layer attribute of this component. |
| public JLayeredPane | Returns: aJLayeredPane objectImplements javax. Returns the layered pane for this internal frame. |
| public JMenuBar | Returns: the current menu bar, ornull if none has been set
Deprecated
As of Swing version 1.0.3,
replaced by
getJMenuBar().
Returns the current |
| public Component | Returns: the child component that will receive focus when thisJInternalFrame is selectedReturns the child component of this |
| public Rectangle | Returns: aRectangle containing the bounds of this
frame when in the normal stateIf the |
| public JRootPane | Returns: therootPane propertyOverrides javax. Implements javax. Returns the |
| public String | Returns: aString containing this internal frame's titleReturns the title of the |
| public InternalFrameUI | Returns: theInternalFrameUI object that renders
this componentOverrides javax. Returns the look-and-feel object that renders this component. |
| public String | Returns: the string "InternalFrameUI"Overrides javax. Returns the name of the look-and-feel class that renders this component. |
| public final String | Returns: null
Deprecated
for removal since 24. since JDK 24
Gets the warning string that is displayed with this internal frame. |
| public void | |
| public boolean | Returns: true if this internal frame can be closedReturns whether this |
| public boolean | Returns: true if this internal frame is closed, false otherwiseReturns whether this |
| public final boolean | Returns: trueOverrides java. Always returns |
| public boolean | Returns: true if this internal frame is iconifiedReturns whether the |
| public boolean | Returns: the value of theiconable property.Gets the |
| public boolean | Returns: the value of themaximizable propertyGets the value of the |
| public boolean | Returns: true if this internal frame is maximized, false otherwiseReturns whether the |
| public boolean | Returns: true if this internal frame can be resized, false otherwiseReturns whether the |
| protected boolean | Returns: true ifadd and setLayout
are forwarded; false otherwiseReturns whether calls to |
| public boolean | Returns: true if this internal frame is currently selected (active)Returns whether the |
| public void | moveToBack()
Convenience method that moves this component to position -1 if its
parent is a |
| public void | moveToFront()
Convenience method that moves this component to position 0 if its
parent is a |
| public void | |
| protected void | paintComponent(Graphics g)
Overrides javax. Overridden to allow optimized painting when the internal frame is being dragged. |
| protected String | Returns: a string representation of thisJInternalFrameOverrides javax. Returns a string representation of this |
| public void | remove(Component
the component to be removed comp)Overrides java. Removes the specified component from the container. |
| public void | removeInternalFrameListener(InternalFrameListener
the internal frame listener l)Removes the specified internal frame listener so that it no longer receives internal frame events from this internal frame. |
| public void | reshape(int
an integer giving the component's new horizontal position
measured in pixels from the left of its container x, int an integer giving the component's new vertical position,
measured in pixels from the bottom of its container y, int an integer giving the component's new width in pixels width, int an integer giving the component's new height in pixels height)Overrides javax. Moves and resizes this component. |
| public void | restoreSubcomponentFocus()
Requests the internal frame to restore focus to the last subcomponent that had focus. |
| public void | setClosable(boolean
a boolean value, where b)true means this internal frame can be closedSets whether this |
| public void | |
| public void | setContentPane(Container
the content pane for this internal frame c)Implements javax. Sets this |
| public void | setCursor(Cursor cursor)
Overrides java. Sets the cursor image to the specified cursor. |
| public void | setDefaultCloseOperation(int
one of the following constants defined in
operation)javax.swing.WindowConstants
(an interface implemented by
JInternalFrame):
DO_NOTHING_ON_CLOSE,
HIDE_ON_CLOSE, or
DISPOSE_ON_CLOSESets the operation that will happen by default when the user initiates a "close" on this internal frame. |
| public void | setDesktopIcon(JInternalFrame.
the dJDesktopIcon to display on the desktopSets the |
| public final void | setFocusCycleRoot(boolean
this value is ignored focusCycleRoot)Overrides java. Does nothing because |
| public void | setFrameIcon(Icon
the icon)Icon to display in the title barSets an image to be displayed in the titlebar of this internal frame (usually in the top-left corner). |
| public void | setGlassPane(Component
the glass pane for this internal frame glass)Implements javax. Sets this |
| public void | setIcon(boolean
a boolean, where b)true means to iconify this internal frame and
false means to de-iconify itIconifies or de-iconifies this internal frame, if the look and feel supports iconification. |
| public void | setIconifiable(boolean
a boolean, where b)true means this internal frame can be iconifiedSets the |
| public void | setJMenuBar(JMenuBar
the m)JMenuBar to use in this internal frameSets the |
| private void | |
| public void | |
| public void | setLayer(int
an integer specifying this internal frame's desktop layer layer)Convenience method for setting the layer attribute of this component. |
| public void | setLayeredPane(JLayeredPane
the layered)JLayeredPane for this internal frameImplements javax. Sets this |
| public void | setLayout(LayoutManager
the manager)LayoutManagerOverrides java. Ensures that, by default, the layout of this component cannot be set. |
| public void | setMaximizable(boolean
true to specify that this internal frame should be maximizable; false to specify that it should not beSets the |
| public void | setMaximum(boolean
a boolean, where b)true maximizes this internal frame and false
restores itMaximizes and restores this internal frame. |
| public void | setMenuBar(JMenuBar
the m)JMenuBar to use in this internal frame
Deprecated
As of Swing version 1.0.3
replaced by
setJMenuBar(JMenuBar m).
Sets the |
| public void | setNormalBounds(Rectangle
the bounds that this internal frame should be restored to r)Sets the normal bounds for this internal frame, the bounds that this internal frame would be restored to from its maximized state. |
| public void | setResizable(boolean
a boolean, where b)true means this internal frame can be resizedSets whether the |
| protected void | setRootPane(JRootPane
the new root)JRootPane objectSets the |
| protected void | setRootPaneCheckingEnabled(boolean
true if enabled)add and setLayout
are forwarded, false if they should operate directly on the
JInternalFrame.Sets whether calls to |
| public void | setSelected(boolean
a boolean, where selected)true means this internal frame
should become selected (currently active)
and false means it should become deselectedSelects or deselects the internal frame if it's showing. |
| public void | |
| public void | |
| public void | show()
Overrides java. If the internal frame is not visible, brings the internal frame to the front, makes it visible, and attempts to select it. |
| public void | |
| public void | |
| private static void | |
| public void | updateUI()
Overrides javax. Notification from the |
| pack-priv void | |
| private void | writeObject(ObjectOutputStream s)
Hides javax. See |