Class JInternalFrame
- All Implemented Interfaces:
- ImageObserver,- MenuContainer,- Serializable,- Accessible,- RootPaneContainer,- WindowConstants
 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:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classThis class implements accessibility support for theJInternalFrameclass.static classThis component represents an iconified version of aJInternalFrame.Nested classes/interfaces declared in class javax.swing.JComponentJComponent.AccessibleJComponentNested classes/interfaces declared in class java.awt.ContainerContainer.AccessibleAWTContainerNested classes/interfaces declared in class java.awt.ComponentComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected booleanThe frame can be closed.static final StringBound property name.protected JInternalFrame.JDesktopIconThe icon that is displayed when this internal frame is iconified.static final StringBound property name.protected IconThe icon shown in the top-left corner of this internal frame.static final StringBound property name.protected booleanThe frame can "iconified" (shrunk down and displayed as an icon-image).static final StringConstrained property name indicating that the internal frame is closed.static final StringConstrained property name indicating that the internal frame is iconified.static final StringConstrained property name indicating that the internal frame is maximized.static final StringConstrained property name indicated that this frame has selected status.protected booleanThe frame has been closed.protected booleanThe frame has been iconified.protected booleanThe frame has been expanded to its maximum size.protected booleanThe frame is currently selected.static final StringBound property name.protected booleanThe frame can be expanded to the size of the desktop pane.static final StringBound property name.protected booleanThe frame's size can be changed.static final StringBound property name.protected JRootPaneTheJRootPaneinstance that manages the content pane and optional menu bar for this internal frame, as well as the glass pane.protected booleanIf true then calls toaddandsetLayoutwill be forwarded to thecontentPane.protected StringThe title displayed in this internal frame's title bar.static final StringBound property name.Fields declared in class javax.swing.JComponentlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields declared in class java.awt.ComponentaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields declared in interface java.awt.image.ImageObserverABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields declared in interface javax.swing.WindowConstantsDISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a non-resizable, non-closable, non-maximizable, non-iconifiableJInternalFramewith no title.JInternalFrame(String title) Creates a non-resizable, non-closable, non-maximizable, non-iconifiableJInternalFramewith the specified title.JInternalFrame(String title, boolean resizable) Creates a non-closable, non-maximizable, non-iconifiableJInternalFramewith the specified title and resizability.JInternalFrame(String title, boolean resizable, boolean closable) Creates a non-maximizable, non-iconifiableJInternalFramewith the specified title, resizability, and closability.JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable) Creates a non-iconifiableJInternalFramewith the specified title, resizability, closability, and maximizability.JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable) Creates aJInternalFramewith the specified title, resizability, closability, maximizability, and iconifiability.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidAdds the specified childComponent.voidAdds the specified listener to receive internal frame events from this internal frame.protected JRootPaneCalled by the constructor to set up theJRootPane.voiddispose()Makes this internal frame invisible, unselected, and closed.voidFires anINTERNAL_FRAME_CLOSINGevent and then performs the action specified by the internal frame's default close operation.protected voidfireInternalFrameEvent(int id) Fires an internal frame event.Gets theAccessibleContextassociated with thisJInternalFrame.Returns the content pane for this internal frame.intReturns the default operation that occurs when the user initiates a "close" on this internal frame.Returns theJDesktopIconused when thisJInternalFrameis iconified.Convenience method that searches the ancestor hierarchy for aJDesktopinstance.final ContainerAlways returnsnullbecauseJInternalFrames must always be roots of a focus traversal cycle.If thisJInternalFrameis active, returns the child that has focus.Returns the image displayed in the title bar of this internal frame (usually in the top-left corner).Returns the glass pane for this internal frame.Returns an array of all theInternalFrameListeners added to thisJInternalFramewithaddInternalFrameListener.Returns the currentJMenuBarfor thisJInternalFrame, ornullif no menu bar has been set.Returns the lastCursorthat was set by thesetCursormethod that is not a resizableCursor.intgetLayer()Convenience method for getting the layer attribute of this component.Returns the layered pane for this internal frame.Deprecated.Returns the child component of thisJInternalFramethat will receive the focus when thisJInternalFrameis selected.If theJInternalFrameis not in maximized state, returnsgetBounds(); otherwise, returns the bounds that theJInternalFramewould be restored to.Returns therootPaneobject for this internal frame.getTitle()Returns the title of theJInternalFrame.getUI()Returns the look-and-feel object that renders this component.Returns the name of the look-and-feel class that renders this component.final StringDeprecated, for removal: This API element is subject to removal in a future version.since JDK 24voidhide()booleanReturns whether thisJInternalFramecan be closed by some user action.booleanisClosed()Returns whether thisJInternalFrameis currently closed.final booleanAlways returnstruebecause allJInternalFrames must be roots of a focus traversal cycle.booleanisIcon()Returns whether theJInternalFrameis currently iconified.booleanGets theiconableproperty, which by default isfalse.booleanGets the value of themaximizableproperty.booleanReturns whether theJInternalFrameis currently maximized.booleanReturns whether theJInternalFramecan be resized by some user action.protected booleanReturns whether calls toaddandsetLayoutare forwarded to thecontentPane.booleanReturns whether theJInternalFrameis the currently "selected" or active frame.voidConvenience method that moves this component to position -1 if its parent is aJLayeredPane.voidConvenience method that moves this component to position 0 if its parent is aJLayeredPane.voidpack()Causes subcomponents of thisJInternalFrameto be laid out at their preferred size.protected voidOverridden to allow optimized painting when the internal frame is being dragged.protected StringReturns a string representation of thisJInternalFrame.voidRemoves the specified component from the container.voidRemoves the specified internal frame listener so that it no longer receives internal frame events from this internal frame.voidreshape(int x, int y, int width, int height) Moves and resizes this component.voidRequests the internal frame to restore focus to the last subcomponent that had focus.voidsetClosable(boolean b) Sets whether thisJInternalFramecan be closed by some user action.voidsetClosed(boolean b) Closes this internal frame if the argument istrue.voidSets thisJInternalFrame'scontentPaneproperty.voidSets the cursor image to the specified cursor.voidsetDefaultCloseOperation(int operation) Sets the operation that will happen by default when the user initiates a "close" on this internal frame.voidSets theJDesktopIconassociated with thisJInternalFrame.final voidsetFocusCycleRoot(boolean focusCycleRoot) Does nothing becauseJInternalFrames must always be roots of a focus traversal cycle.voidsetFrameIcon(Icon icon) Sets an image to be displayed in the titlebar of this internal frame (usually in the top-left corner).voidsetGlassPane(Component glass) Sets thisJInternalFrame'sglassPaneproperty.voidsetIcon(boolean b) Iconifies or de-iconifies this internal frame, if the look and feel supports iconification.voidsetIconifiable(boolean b) Sets theiconableproperty, which must betruefor the user to be able to make theJInternalFramean icon.voidSets themenuBarproperty for thisJInternalFrame.voidsetLayer(int layer) Convenience method for setting the layer attribute of this component.voidConvenience method for setting the layer attribute of this component.voidsetLayeredPane(JLayeredPane layered) Sets thisJInternalFrame'slayeredPaneproperty.voidsetLayout(LayoutManager manager) Ensures that, by default, the layout of this component cannot be set.voidsetMaximizable(boolean b) Sets themaximizableproperty, which determines whether theJInternalFramecan be maximized by some user action.voidsetMaximum(boolean b) Maximizes and restores this internal frame.voidDeprecated.As of Swing version 1.0.3 replaced bysetJMenuBar(JMenuBar m).voidSets the normal bounds for this internal frame, the bounds that this internal frame would be restored to from its maximized state.voidsetResizable(boolean b) Sets whether theJInternalFramecan be resized by some user action.protected voidsetRootPane(JRootPane root) Sets therootPaneproperty for thisJInternalFrame.protected voidsetRootPaneCheckingEnabled(boolean enabled) Sets whether calls toaddandsetLayoutare forwarded to thecontentPane.voidsetSelected(boolean selected) Selects or deselects the internal frame if it's showing.voidSets theJInternalFrametitle.voidsetUI(InternalFrameUI ui) Sets the UI delegate for thisJInternalFrame.voidshow()If the internal frame is not visible, brings the internal frame to the front, makes it visible, and attempts to select it.voidtoBack()Sends this internal frame to the back.voidtoFront()Brings this internal frame to the front.voidupdateUI()Notification from theUIManagerthat the look and feel has changed.Methods declared in class javax.swing.JComponentaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods declared in class java.awt.Containeradd, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTreeMethods declared in class java.awt.Componentaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
- 
Field Details- 
rootPaneTheJRootPaneinstance that manages the content pane and optional menu bar for this internal frame, as well as the glass pane.- See Also:
 
- 
rootPaneCheckingEnabledprotected boolean rootPaneCheckingEnabledIf true then calls toaddandsetLayoutwill be forwarded to thecontentPane. This is initially false, but is set to true when theJInternalFrameis constructed.- See Also:
 
- 
closableprotected boolean closableThe frame can be closed.
- 
isClosedprotected boolean isClosedThe frame has been closed.
- 
maximizableprotected boolean maximizableThe frame can be expanded to the size of the desktop pane.
- 
isMaximumprotected boolean isMaximumThe frame has been expanded to its maximum size.- See Also:
 
- 
iconableprotected boolean iconableThe frame can "iconified" (shrunk down and displayed as an icon-image).- See Also:
 
- 
isIconprotected boolean isIconThe frame has been iconified.- See Also:
 
- 
resizableprotected boolean resizableThe frame's size can be changed.
- 
isSelectedprotected boolean isSelectedThe frame is currently selected.
- 
frameIconThe icon shown in the top-left corner of this internal frame.
- 
titleThe title displayed in this internal frame's title bar.
- 
desktopIconThe icon that is displayed when this internal frame is iconified. Subclassers must ensure this is set to a non-null value during construction and not subsequently set this to null.- See Also:
 
- 
CONTENT_PANE_PROPERTY
- 
MENU_BAR_PROPERTY
- 
TITLE_PROPERTY
- 
LAYERED_PANE_PROPERTY
- 
ROOT_PANE_PROPERTY
- 
GLASS_PANE_PROPERTY
- 
FRAME_ICON_PROPERTY
- 
IS_SELECTED_PROPERTYConstrained property name indicated that this frame has selected status.- See Also:
 
- 
IS_CLOSED_PROPERTYConstrained property name indicating that the internal frame is closed.- See Also:
 
- 
IS_MAXIMUM_PROPERTYConstrained property name indicating that the internal frame is maximized.- See Also:
 
- 
IS_ICON_PROPERTYConstrained property name indicating that the internal frame is iconified.- See Also:
 
 
- 
- 
Constructor Details- 
JInternalFramepublic JInternalFrame()Creates a non-resizable, non-closable, non-maximizable, non-iconifiableJInternalFramewith no title.
- 
JInternalFrameCreates a non-resizable, non-closable, non-maximizable, non-iconifiableJInternalFramewith the specified title. Note that passing in anulltitleresults in unspecified behavior and possibly an exception.- Parameters:
- title- the non-- null- Stringto display in the title bar
 
- 
JInternalFrameCreates a non-closable, non-maximizable, non-iconifiableJInternalFramewith the specified title and resizability.- Parameters:
- title- the- Stringto display in the title bar
- resizable- if- true, the internal frame can be resized
 
- 
JInternalFrameCreates a non-maximizable, non-iconifiableJInternalFramewith the specified title, resizability, and closability.- Parameters:
- title- the- Stringto display in the title bar
- resizable- if- true, the internal frame can be resized
- closable- if- true, the internal frame can be closed
 
- 
JInternalFrameCreates a non-iconifiableJInternalFramewith the specified title, resizability, closability, and maximizability.- Parameters:
- title- the- Stringto 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
 
- 
JInternalFramepublic JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable) Creates aJInternalFramewith the specified title, resizability, closability, maximizability, and iconifiability. AllJInternalFrameconstructors use this one.- Parameters:
- title- the- Stringto 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- 
createRootPaneCalled by the constructor to set up theJRootPane.- Returns:
- a new JRootPane
- See Also:
 
- 
getUIReturns the look-and-feel object that renders this component.- Overrides:
- getUIin class- JComponent
- Returns:
- the InternalFrameUIobject that renders this component
 
- 
setUI@BeanProperty(hidden=true, visualUpdate=true, description="The UI object that implements the Component's LookAndFeel.") public void setUI(InternalFrameUI ui) Sets the UI delegate for thisJInternalFrame.- Parameters:
- ui- the UI delegate
 
- 
updateUIpublic void updateUI()Notification from theUIManagerthat the look and feel has changed. Replaces the current UI object with the latest version from theUIManager.- Overrides:
- updateUIin class- JComponent
- See Also:
 
- 
getUIClassIDReturns the name of the look-and-feel class that renders this component.- Overrides:
- getUIClassIDin class- JComponent
- Returns:
- the string "InternalFrameUI"
- See Also:
 
- 
isRootPaneCheckingEnabledprotected boolean isRootPaneCheckingEnabled()Returns whether calls toaddandsetLayoutare forwarded to thecontentPane.- Returns:
- true if addandsetLayoutare forwarded; false otherwise
- See Also:
 
- 
setRootPaneCheckingEnabled@BeanProperty(hidden=true, description="Whether the add and setLayout methods are forwarded") protected void setRootPaneCheckingEnabled(boolean enabled) Sets whether calls toaddandsetLayoutare forwarded to thecontentPane.- Parameters:
- enabled- true if- addand- setLayoutare forwarded, false if they should operate directly on the- JInternalFrame.
- See Also:
 
- 
addImplAdds the specified childComponent. This method is overridden to conditionally forward calls to thecontentPane. By default, children are added to thecontentPaneinstead of the frame, refer toRootPaneContainerfor details.- Overrides:
- addImplin class- Container
- Parameters:
- comp- the component to be enhanced
- constraints- the constraints to be respected
- index- the index
- Throws:
- IllegalArgumentException- if- indexis invalid
- IllegalArgumentException- if adding the container's parent to itself
- IllegalArgumentException- if adding a window to a container
- See Also:
 
- 
removeRemoves the specified component from the container. Ifcompis not a child of theJInternalFramethis will forward the call to thecontentPane.- Overrides:
- removein class- Container
- Parameters:
- comp- the component to be removed
- Throws:
- NullPointerException- if- compis null
- See Also:
 
- 
setLayoutEnsures that, by default, the layout of this component cannot be set. Overridden to conditionally forward the call to thecontentPane. Refer toRootPaneContainerfor more information.
- 
getMenuBarDeprecated.As of Swing version 1.0.3, replaced bygetJMenuBar().Returns the currentJMenuBarfor thisJInternalFrame, ornullif no menu bar has been set.- Returns:
- the current menu bar, or nullif none has been set
 
- 
getJMenuBarReturns the currentJMenuBarfor thisJInternalFrame, ornullif no menu bar has been set.- Returns:
- the JMenuBarused by this internal frame
- See Also:
 
- 
setMenuBarDeprecated.As of Swing version 1.0.3 replaced bysetJMenuBar(JMenuBar m).Sets themenuBarproperty for thisJInternalFrame.- Parameters:
- m- the- JMenuBarto use in this internal frame
- See Also:
 
- 
setJMenuBar@BeanProperty(preferred=true, description="The menu bar for accessing pulldown menus from this internal frame.") public void setJMenuBar(JMenuBar m) Sets themenuBarproperty for thisJInternalFrame.- Parameters:
- m- the- JMenuBarto use in this internal frame
- See Also:
 
- 
getContentPaneReturns the content pane for this internal frame.- Specified by:
- getContentPanein interface- RootPaneContainer
- Returns:
- the content pane
- See Also:
 
- 
setContentPane@BeanProperty(hidden=true, description="The client area of the internal frame where child components are normally inserted.") public void setContentPane(Container c) Sets thisJInternalFrame'scontentPaneproperty.- Specified by:
- setContentPanein interface- RootPaneContainer
- Parameters:
- c- the content pane for this internal frame
- Throws:
- IllegalComponentStateException- (a runtime exception) if the content pane parameter is- null
- See Also:
 
- 
getLayeredPaneReturns the layered pane for this internal frame.- Specified by:
- getLayeredPanein interface- RootPaneContainer
- Returns:
- a JLayeredPaneobject
- See Also:
 
- 
setLayeredPane@BeanProperty(hidden=true, description="The pane which holds the various desktop layers.") public void setLayeredPane(JLayeredPane layered) Sets thisJInternalFrame'slayeredPaneproperty.- Specified by:
- setLayeredPanein interface- RootPaneContainer
- Parameters:
- layered- the- JLayeredPanefor this internal frame
- Throws:
- IllegalComponentStateException- (a runtime exception) if the layered pane parameter is- null
- See Also:
 
- 
getGlassPaneReturns the glass pane for this internal frame.- Specified by:
- getGlassPanein interface- RootPaneContainer
- Returns:
- the glass pane
- See Also:
 
- 
setGlassPane@BeanProperty(hidden=true, description="A transparent pane used for menu rendering.") public void setGlassPane(Component glass) Sets thisJInternalFrame'sglassPaneproperty.- Specified by:
- setGlassPanein interface- RootPaneContainer
- Parameters:
- glass- the glass pane for this internal frame
- See Also:
 
- 
getRootPane@BeanProperty(hidden=true, description="The root pane used by this internal frame.") public JRootPane getRootPane()Returns therootPaneobject for this internal frame.- Specified by:
- getRootPanein interface- RootPaneContainer
- Overrides:
- getRootPanein class- JComponent
- Returns:
- the rootPaneproperty
- See Also:
 
- 
setRootPaneSets therootPaneproperty for thisJInternalFrame. This method is called by the constructor.- Parameters:
- root- the new- JRootPaneobject
 
- 
setClosable@BeanProperty(preferred=true, description="Indicates whether this internal frame can be closed.") public void setClosable(boolean b) Sets whether thisJInternalFramecan be closed by some user action.- Parameters:
- b- a boolean value, where- truemeans this internal frame can be closed
 
- 
isClosablepublic boolean isClosable()Returns whether thisJInternalFramecan be closed by some user action.- Returns:
- trueif this internal frame can be closed
 
- 
isClosedpublic boolean isClosed()Returns whether thisJInternalFrameis currently closed.- Returns:
- trueif this internal frame is closed,- falseotherwise
 
- 
setClosed@BeanProperty(description="Indicates whether this internal frame has been closed.") public void setClosed(boolean b) throws PropertyVetoException Closes this internal frame if the argument istrue. Do not invoke this method with afalseargument; the result of invokingsetClosed(false)is unspecified.If the internal frame is already closed, this method does nothing and returns immediately. Otherwise, this method begins by firing an INTERNAL_FRAME_CLOSINGevent. Then this method sets theclosedproperty totrueunless a listener vetoes the property change. This method finishes by making the internal frame invisible and unselected, and then firing anINTERNAL_FRAME_CLOSEDevent.Note: To reuse an internal frame that has been closed, you must add it to a container (even if you never removed it from its previous container). Typically, this container will be the JDesktopPanethat previously contained the internal frame.- Parameters:
- b- must be- true
- Throws:
- PropertyVetoException- when the attempt to set the property is vetoed by the- JInternalFrame
- See Also:
 
- 
setResizable@BeanProperty(preferred=true, description="Determines whether this internal frame can be resized by the user.") public void setResizable(boolean b) Sets whether theJInternalFramecan be resized by some user action.- Parameters:
- b- a boolean, where- truemeans this internal frame can be resized
 
- 
isResizablepublic boolean isResizable()Returns whether theJInternalFramecan be resized by some user action.- Returns:
- trueif this internal frame can be resized,- falseotherwise
 
- 
setIconifiable@BeanProperty(preferred=true, description="Determines whether this internal frame can be iconified.") public void setIconifiable(boolean b) Sets theiconableproperty, which must betruefor the user to be able to make theJInternalFramean icon. Some look and feels might not implement iconification; they will ignore this property.- Parameters:
- b- a boolean, where- truemeans this internal frame can be iconified
 
- 
isIconifiablepublic boolean isIconifiable()Gets theiconableproperty, which by default isfalse.- Returns:
- the value of the iconableproperty.
- See Also:
 
- 
isIconpublic boolean isIcon()Returns whether theJInternalFrameis currently iconified.- Returns:
- trueif this internal frame is iconified
 
- 
setIcon@BeanProperty(description="The image displayed when this internal frame is minimized.") public void setIcon(boolean b) throws PropertyVetoException Iconifies or de-iconifies this internal frame, if the look and feel supports iconification. If the internal frame's state changes to iconified, this method fires anINTERNAL_FRAME_ICONIFIEDevent. If the state changes to de-iconified, anINTERNAL_FRAME_DEICONIFIEDevent is fired.- Parameters:
- b- a boolean, where- truemeans to iconify this internal frame and- falsemeans to de-iconify it
- Throws:
- PropertyVetoException- when the attempt to set the property is vetoed by the- JInternalFrame
- See Also:
 
- 
setMaximizable@BeanProperty(preferred=true, description="Determines whether this internal frame can be maximized.") public void setMaximizable(boolean b) Sets themaximizableproperty, which determines whether theJInternalFramecan be maximized by some user action. Some look and feels might not support maximizing internal frames; they will ignore this property.- Parameters:
- b-- trueto specify that this internal frame should be maximizable;- falseto specify that it should not be
 
- 
isMaximizablepublic boolean isMaximizable()Gets the value of themaximizableproperty.- Returns:
- the value of the maximizableproperty
- See Also:
 
- 
isMaximumpublic boolean isMaximum()Returns whether theJInternalFrameis currently maximized.- Returns:
- trueif this internal frame is maximized,- falseotherwise
 
- 
setMaximum@BeanProperty(description="Indicates whether this internal frame is maximized.") public void setMaximum(boolean b) throws PropertyVetoException Maximizes and restores this internal frame. A maximized frame is resized to fully fit theJDesktopPanearea associated with theJInternalFrame. A restored frame's size is set to theJInternalFrame's actual size.- Parameters:
- b- a boolean, where- truemaximizes this internal frame and- falserestores it
- Throws:
- PropertyVetoException- when the attempt to set the property is vetoed by the- JInternalFrame
 
- 
getTitleReturns the title of theJInternalFrame.- Returns:
- a Stringcontaining this internal frame's title
- See Also:
 
- 
setTitle@BeanProperty(preferred=true, description="The text displayed in the title bar.") public void setTitle(String title) Sets theJInternalFrametitle.titlemay have anullvalue.- Parameters:
- title- the- Stringto display in the title bar
- See Also:
 
- 
setSelected@BeanProperty(description="Indicates whether this internal frame is currently the active frame.") public void setSelected(boolean selected) throws PropertyVetoException Selects or deselects the internal frame if it's showing. AJInternalFramenormally draws its title bar differently if it is the selected frame, which indicates to the user that this internal frame has the focus. When this method changes the state of the internal frame from deselected to selected, it fires anInternalFrameEvent.INTERNAL_FRAME_ACTIVATEDevent. If the change is from selected to deselected, anInternalFrameEvent.INTERNAL_FRAME_DEACTIVATEDevent is fired.- Parameters:
- selected- a boolean, where- truemeans this internal frame should become selected (currently active) and- falsemeans it should become deselected
- Throws:
- PropertyVetoException- when the attempt to set the property is vetoed by the- JInternalFrame
- See Also:
 
- 
isSelectedpublic boolean isSelected()Returns whether theJInternalFrameis the currently "selected" or active frame.- Returns:
- trueif this internal frame is currently selected (active)
- See Also:
 
- 
setFrameIcon@BeanProperty(description="The icon shown in the top-left corner of this internal frame.") public void setFrameIcon(Icon icon) Sets an image to be displayed in the titlebar of this internal frame (usually in the top-left corner). Some look and feels might not support displaying an icon in the titlebar. This image is not thedesktopIconobject, which is the image displayed in theJDesktopwhen this internal frame is iconified. Passingnullto this function is valid, but the look and feel can choose the appropriate behavior for that situation, such as displaying no icon or a default icon for the look and feel.- Parameters:
- icon- the- Iconto display in the title bar
- See Also:
 
- 
getFrameIconReturns the image displayed in the title bar of this internal frame (usually in the top-left corner).- Returns:
- the Icondisplayed in the title bar
- See Also:
 
- 
moveToFrontpublic void moveToFront()Convenience method that moves this component to position 0 if its parent is aJLayeredPane.
- 
moveToBackpublic void moveToBack()Convenience method that moves this component to position -1 if its parent is aJLayeredPane.
- 
getLastCursorReturns the lastCursorthat was set by thesetCursormethod that is not a resizableCursor.- Returns:
- the last non-resizable Cursor
- Since:
- 1.6
 
- 
setCursorSets the cursor image to the specified cursor. This cursor image is displayed when thecontainsmethod for this component returns true for the current cursor location, and this Component is visible, displayable, and enabled. Setting the cursor of aContainercauses that cursor to be displayed within all of the container's subcomponents, except for those that have a non-nullcursor.The method may have no visual effect if the Java platform implementation and/or the native system do not support changing the mouse cursor shape. 
- 
setLayer@BeanProperty(bound=false, expert=true, description="Specifies what desktop layer is used.") public void setLayer(Integer layer) Convenience method for setting the layer attribute of this component.- Parameters:
- layer- an- Integerobject specifying this frame's desktop layer
- Throws:
- NullPointerException- if- layeris- null
- See Also:
 
- 
setLayer@BeanProperty(bound=false, expert=true, description="Specifies what desktop layer is used.") public void setLayer(int layer) Convenience method for setting the layer attribute of this component. The methodsetLayer(Integer)should be used for layer values predefined inJLayeredPane. When usingsetLayer(int), care must be taken not to accidentally clash with those values.- Parameters:
- layer- an integer specifying this internal frame's desktop layer
- Since:
- 1.3
- See Also:
 
- 
getLayerpublic int getLayer()Convenience method for getting the layer attribute of this component.- Returns:
- an Integerobject specifying this frame's desktop layer
- See Also:
 
- 
getDesktopPaneConvenience method that searches the ancestor hierarchy for aJDesktopinstance. IfJInternalFramefinds none, thedesktopIcontree is searched.- Returns:
- the JDesktopPanethis internal frame belongs to, ornullif none is found
 
- 
setDesktopIcon@BeanProperty(description="The icon shown when this internal frame is minimized.") public void setDesktopIcon(JInternalFrame.JDesktopIcon d) Sets theJDesktopIconassociated with thisJInternalFrame.- Parameters:
- d- the- JDesktopIconto display on the desktop
- Throws:
- NullPointerException- if the- dis- null
- See Also:
 
- 
getDesktopIconReturns theJDesktopIconused when thisJInternalFrameis iconified.- Returns:
- the JDesktopIcondisplayed on the desktop
- See Also:
 
- 
getNormalBoundsIf theJInternalFrameis not in maximized state, returnsgetBounds(); otherwise, returns the bounds that theJInternalFramewould be restored to.- Returns:
- a Rectanglecontaining the bounds of this frame when in the normal state
- Since:
- 1.3
 
- 
setNormalBoundsSets the normal bounds for this internal frame, the bounds that this internal frame would be restored to from its maximized state. This method is intended for use only by desktop managers.- Parameters:
- r- the bounds that this internal frame should be restored to
- Since:
- 1.3
 
- 
getFocusOwnerIf thisJInternalFrameis active, returns the child that has focus. Otherwise, returnsnull.- Returns:
- the component with focus, or nullif no children have focus
- Since:
- 1.3
 
- 
getMostRecentFocusOwnerReturns the child component of thisJInternalFramethat will receive the focus when thisJInternalFrameis selected. If thisJInternalFrameis currently selected, this method returns the same component as thegetFocusOwnermethod. If thisJInternalFrameis not selected, then the child component that most recently requested focus will be returned. If no child component has ever requested focus, then thisJInternalFrame's initial focusable component is returned. If no such child exists, then thisJInternalFrame's default component to focus is returned.- Returns:
- the child component that will receive focus when this
         JInternalFrameis selected
- Since:
- 1.4
- See Also:
 
- 
restoreSubcomponentFocuspublic void restoreSubcomponentFocus()Requests the internal frame to restore focus to the last subcomponent that had focus. This is used by the UI when the user selected this internal frame -- for example, by clicking on the title bar.- Since:
- 1.3
 
- 
reshapepublic void reshape(int x, int y, int width, int height) Moves and resizes this component. Unlike other components, this implementation also forces re-layout, so that frame decorations such as the title bar are always redisplayed.- Overrides:
- reshapein class- JComponent
- Parameters:
- x- an integer giving the component's new horizontal position measured in pixels from the left of its container
- y- an integer giving the component's new vertical position, measured in pixels from the bottom of its container
- width- an integer giving the component's new width in pixels
- height- an integer giving the component's new height in pixels
- See Also:
 
- 
addInternalFrameListenerAdds the specified listener to receive internal frame events from this internal frame.- Parameters:
- l- the internal frame listener
 
- 
removeInternalFrameListenerRemoves the specified internal frame listener so that it no longer receives internal frame events from this internal frame.- Parameters:
- l- the internal frame listener
 
- 
getInternalFrameListenersReturns an array of all theInternalFrameListeners added to thisJInternalFramewithaddInternalFrameListener.- Returns:
- all of the InternalFrameListeners added or an empty array if no listeners have been added
- Since:
- 1.4
- See Also:
 
- 
fireInternalFrameEventprotected void fireInternalFrameEvent(int id) Fires an internal frame event.- Parameters:
- id- the type of the event being fired; one of the following:- InternalFrameEvent.INTERNAL_FRAME_OPENED
- InternalFrameEvent.INTERNAL_FRAME_CLOSING
- InternalFrameEvent.INTERNAL_FRAME_CLOSED
- InternalFrameEvent.INTERNAL_FRAME_ICONIFIED
- InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED
- InternalFrameEvent.INTERNAL_FRAME_ACTIVATED
- InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED
 
 
- 
doDefaultCloseActionpublic void doDefaultCloseAction()Fires anINTERNAL_FRAME_CLOSINGevent and then performs the action specified by the internal frame's default close operation. This method is typically invoked by the look-and-feel-implemented action handler for the internal frame's close button.- Since:
- 1.3
- See Also:
 
- 
setDefaultCloseOperationpublic void setDefaultCloseOperation(int operation) Sets the operation that will happen by default when the user initiates a "close" on this internal frame. The possible choices are:
 - DO_NOTHING_ON_CLOSE
-  Do nothing.
      This requires the program to handle the operation
      in the internalFrameClosingmethod of a registeredInternalFrameListenerobject.
- HIDE_ON_CLOSE
- Automatically make the internal frame invisible.
- DISPOSE_ON_CLOSE
- Automatically dispose of the internal frame.
 The default value is DISPOSE_ON_CLOSE. Before performing the specified close operation, the internal frame fires anINTERNAL_FRAME_CLOSINGevent.- Parameters:
- operation- one of the following constants defined in- javax.swing.WindowConstants(an interface implemented by- JInternalFrame):- DO_NOTHING_ON_CLOSE,- HIDE_ON_CLOSE, or- DISPOSE_ON_CLOSE
- See Also:
 
- 
getDefaultCloseOperationpublic int getDefaultCloseOperation()Returns the default operation that occurs when the user initiates a "close" on this internal frame.- Returns:
- the operation that will occur when the user closes the internal frame
- See Also:
 
- 
packpublic void pack()Causes subcomponents of thisJInternalFrameto be laid out at their preferred size. Internal frames that are iconized or maximized are first restored and then packed. If the internal frame is unable to be restored its state is not changed and will not be packed.- See Also:
 
- 
showpublic void show()If the internal frame is not visible, brings the internal frame to the front, makes it visible, and attempts to select it. The first time the internal frame is made visible, this method also fires anINTERNAL_FRAME_OPENEDevent. This method does nothing if the internal frame is already visible. Invoking this method has the same result as invokingsetVisible(true).
- 
hide
- 
disposepublic void dispose()Makes this internal frame invisible, unselected, and closed. If the frame is not already closed, this method fires anINTERNAL_FRAME_CLOSEDevent. The results of invoking this method are similar tosetClosed(true), butdisposealways succeeds in closing the internal frame and does not fire anINTERNAL_FRAME_CLOSINGevent.- See Also:
 
- 
toFrontpublic void toFront()Brings this internal frame to the front. Places this internal frame at the top of the stacking order and makes the corresponding adjustment to other visible internal frames.- See Also:
 
- 
toBackpublic void toBack()Sends this internal frame to the back. Places this internal frame at the bottom of the stacking order and makes the corresponding adjustment to other visible internal frames.- See Also:
 
- 
setFocusCycleRootpublic final void setFocusCycleRoot(boolean focusCycleRoot) Does nothing becauseJInternalFrames must always be roots of a focus traversal cycle.- Overrides:
- setFocusCycleRootin class- Container
- Parameters:
- focusCycleRoot- this value is ignored
- Since:
- 1.4
- See Also:
 
- 
isFocusCycleRootpublic final boolean isFocusCycleRoot()Always returnstruebecause allJInternalFrames must be roots of a focus traversal cycle.- Overrides:
- isFocusCycleRootin class- Container
- Returns:
- true
- Since:
- 1.4
- See Also:
 
- 
getFocusCycleRootAncestorAlways returnsnullbecauseJInternalFrames must always be roots of a focus traversal cycle.- Overrides:
- getFocusCycleRootAncestorin class- Component
- Returns:
- null
- Since:
- 1.4
- See Also:
 
- 
getWarningString@Deprecated(since="24", forRemoval=true) @BeanProperty(bound=false) public final String getWarningString()Deprecated, for removal: This API element is subject to removal in a future version.since JDK 24Gets the warning string that is displayed with this internal frame. This method always returnsnull. Warning strings are no longer applicable, even to top-level windows, so this method may be removed in a future release- Returns:
- null
- See Also:
 
- 
paramStringReturns a string representation of thisJInternalFrame. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not benull.- Overrides:
- paramStringin class- JComponent
- Returns:
- a string representation of this JInternalFrame
 
- 
paintComponentOverridden to allow optimized painting when the internal frame is being dragged.- Overrides:
- paintComponentin class- JComponent
- Parameters:
- g- the- Graphicsobject to protect
- See Also:
 
- 
getAccessibleContextGets theAccessibleContextassociated with thisJInternalFrame. For internal frames, theAccessibleContexttakes the form of anAccessibleJInternalFrameobject. A newAccessibleJInternalFrameinstance is created if necessary.- Specified by:
- getAccessibleContextin interface- Accessible
- Overrides:
- getAccessibleContextin class- Component
- Returns:
- an AccessibleJInternalFramethat serves as theAccessibleContextof thisJInternalFrame
- See Also:
 
 
- 
getJMenuBar().