javax.swing

Class JInternalFrame

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

public class JInternalFrame
extends JComponent
implements Accessible, WindowConstants, RootPaneContainer

This class implements a Swing widget that looks and acts like a native frame. The frame can be dragged, resized, closed, etc. Typically, JInternalFrames are placed in JDesktopPanes. The actions that the JInternalFrame performs (maximizing, minimizing, etc.) are performed by a DesktopManager. As with regular frames, components are added by calling frame.getContentPane().add.
See Also:
Serialized Form

Nested Class Summary

protected class
JInternalFrame.AccessibleJInternalFrame
Provides the accessibility features for the JInternalFrame component.
static class
JInternalFrame.JDesktopIcon
This class represents the JInternalFrame while it is iconified.

Nested classes/interfaces inherited from class javax.swing.JComponent

JComponent.AccessibleJComponent

Nested classes/interfaces inherited from class java.awt.Container

Container.AccessibleAWTContainer

Nested classes/interfaces inherited from class java.awt.Component

Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy

Field Summary

static String
CONTENT_PANE_PROPERTY
The property fired in a PropertyChangeEvent when the contentPane property changes.
static String
FRAME_ICON_PROPERTY
The property fired in a PropertyChangeEvent when the frameIcon property changes.
static String
GLASS_PANE_PROPERTY
The property fired in a PropertyChangeEvent when the glassPane property changes.
static String
IS_CLOSED_PROPERTY
The property fired in a PropertyChangeEvent when the closed property changes.
static String
IS_ICON_PROPERTY
The property fired in a PropertyChangeEvent when the icon property changes.
static String
IS_MAXIMUM_PROPERTY
The property fired in a PropertyChangeEvent when the maximum property changes.
static String
IS_SELECTED_PROPERTY
The property fired in a PropertyChangeEvent when the selected property changes.
static String
LAYERED_PANE_PROPERTY
The property fired in a PropertyChangeEvent when the layeredPane property changes.
static String
MENU_BAR_PROPERTY
The property fired in a PropertyChangeEvent when the jMenuBar property changes.
static String
ROOT_PANE_PROPERTY
The property fired in a PropertyChangeEvent when the rootPane property changes.
static String
TITLE_PROPERTY
The property fired in a PropertyChangeEvent when the title property changes.
protected boolean
closable
Whether the JInternalFrame is closable.
protected JInternalFrame.JDesktopIcon
desktopIcon
The JDesktopIcon that represents the JInternalFrame while it is iconified.
protected Icon
frameIcon
The icon used in the JMenuBar in the TitlePane.
protected boolean
iconable
Whether the JInternalFrame can be iconified.
protected boolean
isClosed
Whether the JInternalFrame is closed.
protected boolean
isIcon
Whether the JInternalFrame has been iconified.
protected boolean
isMaximum
Whether the JInternalFrame has been maximized.
protected boolean
isSelected
Whether the JInternalFrame is the active frame.
protected boolean
maximizable
Whether the JInternalFrame can be maximized.
protected boolean
resizable
Whether the JInternalFrame is resizable.
protected JRootPane
rootPane
The rootPane of the JInternalFrame.
protected boolean
rootPaneCheckingEnabled
Whether the JInternalFrame has rootPaneChecking enabled.
protected String
title
The title on the TitlePane of the JInternalFrame.

Fields inherited from class javax.swing.JComponent

TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, accessibleContext, listenerList, ui

Fields inherited from class java.awt.Component

BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT

Fields inherited from interface java.awt.image.ImageObserver

ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH

Fields inherited from interface javax.swing.WindowConstants

DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE

Constructor Summary

JInternalFrame()
Creates a new JInternalFrame object that has an empty string for its title, and is non-resizable, non-maximizable, non-iconifiable, and non-closable.
JInternalFrame(String title)
Creates a new JInternalFrame object with the given title and is non-resizable, non-maximizable, non-iconifiable, and non-closable.
JInternalFrame(String title, boolean resizable)
Creates a new JInternalFrame object with the given title and resizable properties.
JInternalFrame(String title, boolean resizable, boolean closable)
Creates a new JInternalFrame object with the given title, resizable, and closable properties.
JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable)
Creates a new JInternalFrame object with the given title, resizable, closable and maximizable properties.
JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable)
Creates a new JInternalFrame object with the given title, resizable, closable, maximizable and iconifiable properties.

Method Summary

protected void
addImpl(Component comp, Object constraints, int index)
This method adds Components to this Container.
void
addInternalFrameListener(InternalFrameListener l)
This method adds an InternalFrameListener to this JInternalFrame.
protected JRootPane
createRootPane()
This method is used to create a root pane for the JInternalFrame.
void
dispose()
This method makes this JInternalFrame invisible, unselected and closed.
void
doDefaultCloseAction()
This method is used for closing this JInternalFrame.
protected void
fireInternalFrameEvent(int id)
This method fires an InternalFrameEvent to the listeners.
AccessibleContext
getAccessibleContext()
Returns the object that provides accessibility features for this JInternalFrame component.
Container
getContentPane()
This method returns the Content Pane for this JInternalFrame.
int
getDefaultCloseOperation()
Returns a code for the default action taken when this JInternalFrame is closed.
JInternalFrame.JDesktopIcon
getDesktopIcon()
Returns the JDesktopIcon that represents this JInternalFrame while it is iconified.
JDesktopPane
getDesktopPane()
This method searches this JInternalFrame ancestors for an instance of JDesktopPane.
Container
getFocusCycleRootAncestor()
This method returns null because this must always be the root of a focus traversal.
Component
getFocusOwner()
This method returns the child Component that will receive focus if this JInternalFrame is selected.
Icon
getFrameIcon()
This method returns the Frame Icon (the icon used in the JInternalFrame TitlePane and iconified frame).
Component
getGlassPane()
This method returns the Glass Pane used with this JInternalFrame.
InternalFrameListener[]
getInternalFrameListeners()
This method returns an array of InternalFrameListeners that are listening to this JInternalFrame.
JMenuBar
getJMenuBar()
This method returns the JMenuBar for this JInternalFrame.
int
getLayer()
This method returns the layer that this JInternalFrame resides in.
JLayeredPane
getLayeredPane()
This method returns the LayeredPane for this JInternalFrame.
JMenuBar
getMenuBar()
Deprecated. 1.0.3
Component
getMostRecentFocusOwner()
This method returns the child Component that will receive focus when the JInternalFrame is selected.
Rectangle
getNormalBounds()
This method returns the bounds of the JInternalFrame if it is not maximized.
JRootPane
getRootPane()
This method returns the Root Pane for this JInternalFrame.
String
getTitle()
Returns the frame's title.
InternalFrameUI
getUI()
This method returns the UI used to represent the JInternalFrame.
String
getUIClassID()
This method returns a String identifier that is used to determine which class acts as the JInternalFrame's UI.
String
getWarningString()
This method returns null.
void
hide()
This method deselects this JInternalFrame and hides it.
boolean
isClosable()
This method returns whether this JInternalFrame is closable.
boolean
isClosed()
This method returns whether this JInternalFrame has been closed.
boolean
isFocusCycleRoot()
This must always return true.
boolean
isIcon()
This method returns whether this JInternalFrame is currently iconified.
boolean
isIconifiable()
This method returns whether the JInternalFrame can be iconified.
boolean
isMaximizable()
This method returns whether this JInternalFrame can be maximized.
boolean
isMaximum()
This method returns whether this JInternalFrame is currently maximized.
boolean
isResizable()
This method returns whether this JInternalFrame is resizable.
protected boolean
isRootPaneCheckingEnabled()
This method returns whether root pane checking is enabled.
boolean
isSelected()
This method returns whether this JInternalFrame is selected.
void
moveToBack()
A helper method that moves this JInternalFrame to the back if the parent is a JLayeredPane.
void
moveToFront()
A helper method that moves this JInternalFrame to the front if the parent is a JLayeredPane.
void
pack()
This method causes the children of this JInternalFrame to be laid out.
protected void
paintComponent(Graphics g)
This method is overridden to allow for speedier painting while this JInternalFramme is being dragged.
protected String
paramString()
An implementation dependent string describing the current state of this JInternalFrame instance.
void
remove(Component comp)
This method removes the given Component from the Container.
void
removeInternalFrameListener(InternalFrameListener l)
This method removes an InternalFrameListener from this JInternalFrame.
void
reshape(int x, int y, int width, int height)
This method resizes and positions this JInternalFrame.
void
restoreSubcomponentFocus()
This method gives focus to the last child Component that had focus.
void
setClosable(boolean b)
This method sets whether this JInternalFrame can be closed.
void
setClosed(boolean b)
This method closes the JInternalFrame if the given boolean is true.
void
setContentPane(Container c)
This method sets the Container to be used as a Content Pane for this JInternalFrame.
void
setDefaultCloseOperation(int operation)
Sets a code for the action to be taken when this JInternalFrame is closed.
void
setDesktopIcon(JInternalFrame.JDesktopIcon d)
Sets the JDesktopIcon instance that represents this JInternalFrame while it is iconified and, if the new icon is not the same instance as the existing icon, sends a PropertyChangeEvent (with the property name "desktopIcon") to all registered listeners..
void
setFocusCycleRoot(boolean focusCycleRoot)
This method does nothing because this must be the root of a focus traversal cycle.
void
setFrameIcon(Icon icon)
This method sets the Icon to be used in two places.
void
setGlassPane(Component glass)
This method sets the Glass Pane used with this JInternalFrame.
void
setIcon(boolean b)
This method iconifies or deiconifies this JInternalFrame given the boolean argument.
void
setIconifiable(boolean b)
This method sets whether the JInternalFrame can be iconified.
void
setJMenuBar(JMenuBar b)
This method sets the JMenuBar to be used with this JInternalFrame.
void
setLayer(int layer)
A helper method that set the layer that this JInternalFrame resides in.
void
setLayer(Integer layer)
A helper method that sets the layer that this JInternalFrame resides in.
void
setLayeredPane(JLayeredPane layered)
This method sets the JLayeredPane to use with this JInternalFrame.
void
setLayout(LayoutManager manager)
This method sets the Layout Manager used in the JInternalFrame.
void
setMaximizable(boolean b)
This method sets whether the JInternalFrame can be maximized.
void
setMaximum(boolean b)
This method sets the JInternalFrame to maximized (if the given argument is true) or restores the JInternalFrame to its normal bounds otherwise.
void
setMenuBar(JMenuBar m)
Deprecated. 1.0.3
void
setNormalBounds(Rectangle r)
This method sets the bounds that this JInternalFrame will be restored to.
void
setResizable(boolean b)
This method sets whether the JInternalFrame can be resized by a user action (like dragging at the frame borders).
protected void
setRootPane(JRootPane root)
This method sets the Root Pane for this JInternalFrame.
protected void
setRootPaneCheckingEnabled(boolean enabled)
This method sets whether root pane checking is enabled.
void
setSelected(boolean selected)
This method sets whether this JInternalFrame is the selected frame in the JDesktopPane (or other container).
void
setTitle(String title)
Sets the title for the JInternalFrame and sends a PropertyChangeEvent (with the property name TITLE_PROPERTY) to all registered listeners.
void
setUI(InternalFrameUI ui)
This method is used to set the UI responsible for the JInternalFrame.
void
show()
This method displays the JInternalFrame.
void
toBack()
This method causes the JInternalFrame to be brough to back in the z-order.
void
toFront()
This method causes the JInternalFrame to be brought to front in the z-order.
void
updateUI()
This method resets the UI to the Look and Feel defaults.

Methods inherited from class javax.swing.JComponent

addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, extends EventListener> T[] getListeners, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI

Methods inherited from class java.awt.Container

add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, extends EventListener> T[] getListeners, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponentZOrder, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree

Methods inherited from class java.awt.Component

action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, extends EventListener> T[] getListeners, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFocusable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFocusable, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

CONTENT_PANE_PROPERTY

public static final String CONTENT_PANE_PROPERTY
The property fired in a PropertyChangeEvent when the contentPane property changes.
Field Value:
"contentPane"

FRAME_ICON_PROPERTY

public static final String FRAME_ICON_PROPERTY
The property fired in a PropertyChangeEvent when the frameIcon property changes.
Field Value:
"frameIcon"

GLASS_PANE_PROPERTY

public static final String GLASS_PANE_PROPERTY
The property fired in a PropertyChangeEvent when the glassPane property changes.
Field Value:
"glassPane"

IS_CLOSED_PROPERTY

public static final String IS_CLOSED_PROPERTY
The property fired in a PropertyChangeEvent when the closed property changes.
Field Value:
"closed"

IS_ICON_PROPERTY

public static final String IS_ICON_PROPERTY
The property fired in a PropertyChangeEvent when the icon property changes.
Field Value:
"icon"

IS_MAXIMUM_PROPERTY

public static final String IS_MAXIMUM_PROPERTY
The property fired in a PropertyChangeEvent when the maximum property changes.
Field Value:
"maximum"

IS_SELECTED_PROPERTY

public static final String IS_SELECTED_PROPERTY
The property fired in a PropertyChangeEvent when the selected property changes.
Field Value:
"selected"

LAYERED_PANE_PROPERTY

public static final String LAYERED_PANE_PROPERTY
The property fired in a PropertyChangeEvent when the layeredPane property changes.
Field Value:
"layeredPane"

MENU_BAR_PROPERTY

public static final String MENU_BAR_PROPERTY
The property fired in a PropertyChangeEvent when the jMenuBar property changes.
Field Value:
"JMenuBar"

ROOT_PANE_PROPERTY

public static final String ROOT_PANE_PROPERTY
The property fired in a PropertyChangeEvent when the rootPane property changes.
Field Value:
"rootPane"

TITLE_PROPERTY

public static final String TITLE_PROPERTY
The property fired in a PropertyChangeEvent when the title property changes.
Field Value:
"title"

closable

protected boolean closable
Whether the JInternalFrame is closable.

desktopIcon

protected JInternalFrame.JDesktopIcon desktopIcon
The JDesktopIcon that represents the JInternalFrame while it is iconified.

frameIcon

protected Icon frameIcon
The icon used in the JMenuBar in the TitlePane.

iconable

protected boolean iconable
Whether the JInternalFrame can be iconified.

isClosed

protected boolean isClosed
Whether the JInternalFrame is closed.

isIcon

protected boolean isIcon
Whether the JInternalFrame has been iconified.

isMaximum

protected boolean isMaximum
Whether the JInternalFrame has been maximized.

isSelected

protected boolean isSelected
Whether the JInternalFrame is the active frame.

maximizable

protected boolean maximizable
Whether the JInternalFrame can be maximized.

resizable

protected boolean resizable
Whether the JInternalFrame is resizable.

rootPane

protected JRootPane rootPane
The rootPane of the JInternalFrame.

rootPaneCheckingEnabled

protected boolean rootPaneCheckingEnabled
Whether the JInternalFrame has rootPaneChecking enabled.

title

protected String title
The title on the TitlePane of the JInternalFrame.

Constructor Details

JInternalFrame

public JInternalFrame()
Creates a new JInternalFrame object that has an empty string for its title, and is non-resizable, non-maximizable, non-iconifiable, and non-closable.

JInternalFrame

public JInternalFrame(String title)
Creates a new JInternalFrame object with the given title and is non-resizable, non-maximizable, non-iconifiable, and non-closable.
Parameters:
title - The title displayed in the JInternalFrame.

JInternalFrame

public JInternalFrame(String title,
                      boolean resizable)
Creates a new JInternalFrame object with the given title and resizable properties. The JInternalFrame is non-maximizable, non-iconifiable, and non-closable.
Parameters:
title - The title displayed in the JInternalFrame.
resizable - Whether the JInternalFrame is resizable.

JInternalFrame

public JInternalFrame(String title,
                      boolean resizable,
                      boolean closable)
Creates a new JInternalFrame object with the given title, resizable, and closable properties. The JInternalFrame is non-maximizable and non-iconifiable.
Parameters:
title - The title displayed in the JInternalFrame.
resizable - Whether the JInternalFrame is resizable.
closable - Whether the JInternalFrame is closable.

JInternalFrame

public JInternalFrame(String title,
                      boolean resizable,
                      boolean closable,
                      boolean maximizable)
Creates a new JInternalFrame object with the given title, resizable, closable and maximizable properties. The JInternalFrame is non-iconifiable.
Parameters:
title - The title displayed in the JInternalFrame.
resizable - Whether the JInternalFrame is resizable.
closable - Whether the JInternalFrame is closable.
maximizable - Whether the JInternalFrame is maximizable.

JInternalFrame

public JInternalFrame(String title,
                      boolean resizable,
                      boolean closable,
                      boolean maximizable,
                      boolean iconifiable)
Creates a new JInternalFrame object with the given title, resizable, closable, maximizable and iconifiable properties.
Parameters:
title - The title displayed in the JInternalFrame.
resizable - Whether the JInternalFrame is resizable.
closable - Whether the JInternalFrame is closable.
maximizable - Whether the JInternalFrame is maximizable.
iconifiable - Whether the JInternalFrame is iconifiable.

Method Details

addImpl

protected void addImpl(Component comp,
                       Object constraints,
                       int index)
This method adds Components to this Container. For JInternalFrames, instead of calling add directly on the JInternalFrame, it should be called with JInternalFrame.getContentPane().add. If root pane checking is enabled, calling this method will cause an exception to be thrown.
Overrides:
addImpl in interface Container
Parameters:
comp - The Component to add.
constraints - The constraints on the Component added.
index - The position to place the Component.

addInternalFrameListener

public void addInternalFrameListener(InternalFrameListener l)
This method adds an InternalFrameListener to this JInternalFrame.
Parameters:
l - The listener to add.

createRootPane

protected JRootPane createRootPane()
This method is used to create a root pane for the JInternalFrame. This method is called by the constructors.
Returns:
A root pane for the JInternalFrame to use.

dispose

public void dispose()
This method makes this JInternalFrame invisible, unselected and closed. If this JInternalFrame is not closed already, it will fire an INTERNAL_FRAME_CLoSED event. This method is similar to setClosed but it doesn't give vetoable listeners a chance to veto and it will not fire an INTERNAL_FRAME_CLOSING event.

doDefaultCloseAction

public void doDefaultCloseAction()
This method is used for closing this JInternalFrame. It fires an INTERNAL_FRAME_CLOSING event and then performs the action specified by the default close operation.

fireInternalFrameEvent

protected void fireInternalFrameEvent(int id)
This method fires an InternalFrameEvent to the listeners.
Parameters:
id - The type of event being fired. See InternalFrameEvent.

getAccessibleContext

public AccessibleContext getAccessibleContext()
Returns the object that provides accessibility features for this JInternalFrame component.
Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in interface JComponent
Returns:
The accessible context (an instance of JInternalFrame.AccessibleJInternalFrame).

getContentPane

public Container getContentPane()
This method returns the Content Pane for this JInternalFrame.
Specified by:
getContentPane in interface RootPaneContainer
Returns:
The Content Pane for this JInternalFrame.

getDefaultCloseOperation

public int getDefaultCloseOperation()
Returns a code for the default action taken when this JInternalFrame is closed.

getDesktopIcon

public JInternalFrame.JDesktopIcon getDesktopIcon()
Returns the JDesktopIcon that represents this JInternalFrame while it is iconified.
Returns:
The desktop icon component.

getDesktopPane

public JDesktopPane getDesktopPane()
This method searches this JInternalFrame ancestors for an instance of JDesktopPane. If one is found, it is returned. If none is found, then it will search the JDesktopIcon for a JDesktopPane.
Returns:
The JDesktopPane that this JInternalFrame belongs to.

getFocusCycleRootAncestor

public final Container getFocusCycleRootAncestor()
This method returns null because this must always be the root of a focus traversal.
Overrides:
getFocusCycleRootAncestor in interface Component
Returns:
always null
Since:
1.4

getFocusOwner

public Component getFocusOwner()
This method returns the child Component that will receive focus if this JInternalFrame is selected.
Returns:
The child Component that will receive focus.

getFrameIcon

public Icon getFrameIcon()
This method returns the Frame Icon (the icon used in the JInternalFrame TitlePane and iconified frame).
Returns:
The Frame Icon.

getGlassPane

public Component getGlassPane()
This method returns the Glass Pane used with this JInternalFrame.
Specified by:
getGlassPane in interface RootPaneContainer
Returns:
The Glass Pane used with this JInternalFrame.

getInternalFrameListeners

public InternalFrameListener[] getInternalFrameListeners()
This method returns an array of InternalFrameListeners that are listening to this JInternalFrame.
Returns:
An array of InternalFrameListeners that are listening to this JInternalFrame.

getJMenuBar

public JMenuBar getJMenuBar()
This method returns the JMenuBar for this JInternalFrame.
Returns:
The JMenuBar for this JInternalFrame.

getLayer

public int getLayer()
This method returns the layer that this JInternalFrame resides in.
Returns:
The layer that this JInternalFrame resides in.

getLayeredPane

public JLayeredPane getLayeredPane()
This method returns the LayeredPane for this JInternalFrame.
Specified by:
getLayeredPane in interface RootPaneContainer
Returns:
The LayeredPane for this JInternalFrame.

getMenuBar

public JMenuBar getMenuBar()

Deprecated. 1.0.3

This method is deprecated. This method returns the JMenuBar for this JInternalFrame.
Returns:
The JMenuBar for this JInternalFrame.

getMostRecentFocusOwner

public Component getMostRecentFocusOwner()
This method returns the child Component that will receive focus when the JInternalFrame is selected. If the JInternalFrame is selected, this method returns getFocusOwner(). Otherwise, it will return the child Component that most recently requested focus. If that is null, then the initial focus Component is returned. If that is null, then the default focus component is returned.
Returns:
The most recent focus owner.

getNormalBounds

public Rectangle getNormalBounds()
This method returns the bounds of the JInternalFrame if it is not maximized. If it is maximized, it returns the bounds of the JInternalFrame before it was maximized (the bounds that it will be restored to).
Returns:
A Rectangle that contains this JInternalFrame's normal bounds (or just its bounds if it is not maximized).

getRootPane

public JRootPane getRootPane()
This method returns the Root Pane for this JInternalFrame.
Specified by:
getRootPane in interface RootPaneContainer
Overrides:
getRootPane in interface JComponent
Returns:
The Root Pane for this JInternalFrame.

getTitle

public String getTitle()
Returns the frame's title.
Returns:
The frame's title (can be null).

getUI

public InternalFrameUI getUI()
This method returns the UI used to represent the JInternalFrame.
Returns:
The UI used to represent the JInternalFrame.

getUIClassID

public String getUIClassID()
This method returns a String identifier that is used to determine which class acts as the JInternalFrame's UI.
Overrides:
getUIClassID in interface JComponent
Returns:
A String identifier to determine a UI class.

getWarningString

public final String getWarningString()
This method returns null.
Returns:
null.

hide

public void hide()
This method deselects this JInternalFrame and hides it.
Overrides:
hide in interface Component

isClosable

public boolean isClosable()
This method returns whether this JInternalFrame is closable.
Returns:
Whether this JInternalFrame is closable.

isClosed

public boolean isClosed()
This method returns whether this JInternalFrame has been closed.
Returns:
Whether this JInternalFrame is closed.

isFocusCycleRoot

public final boolean isFocusCycleRoot()
This must always return true.
Overrides:
isFocusCycleRoot in interface Container
Returns:
always true
Since:
1.4

isIcon

public boolean isIcon()
This method returns whether this JInternalFrame is currently iconified.
Returns:
Whether this JInternalFrame is currently iconified.

isIconifiable

public boolean isIconifiable()
This method returns whether the JInternalFrame can be iconified.
Returns:
Whether the JInternalFrame can be iconified.

isMaximizable

public boolean isMaximizable()
This method returns whether this JInternalFrame can be maximized.
Returns:
Whether this JInternalFrame can be maximized.

isMaximum

public boolean isMaximum()
This method returns whether this JInternalFrame is currently maximized.
Returns:
Whether this JInternalFrame is maximized.

isResizable

public boolean isResizable()
This method returns whether this JInternalFrame is resizable.
Returns:
Whether this JInternalFrame is resizable.

isRootPaneCheckingEnabled

protected boolean isRootPaneCheckingEnabled()
This method returns whether root pane checking is enabled. If root pane checking is enabled, then calls to addImpl and setLayout will throw exceptions.
Returns:
Whether root pane checking is enabled.

isSelected

public boolean isSelected()
This method returns whether this JInternalFrame is selected.
Returns:
Whether this JInternalFrame is selected.

moveToBack

public void moveToBack()
A helper method that moves this JInternalFrame to the back if the parent is a JLayeredPane.

moveToFront

public void moveToFront()
A helper method that moves this JInternalFrame to the front if the parent is a JLayeredPane.

pack

public void pack()
This method causes the children of this JInternalFrame to be laid out. Before it begins, if this JInternalFrame is an icon, then it will be deiconified. If it is maximized, then it will be restored. If either operation fails, then this method will return.

paintComponent

protected void paintComponent(Graphics g)
This method is overridden to allow for speedier painting while this JInternalFramme is being dragged.
Overrides:
paintComponent in interface JComponent
Parameters:
g - The Graphics object to paint with.

paramString

protected String paramString()
An implementation dependent string describing the current state of this JInternalFrame instance.
Overrides:
paramString in interface JComponent
Returns:
A string describing the current state of this JInternalFrame instance.

remove

public void remove(Component comp)
This method removes the given Component from the Container.
Overrides:
remove in interface Container
Parameters:
comp - The Component to remove.

removeInternalFrameListener

public void removeInternalFrameListener(InternalFrameListener l)
This method removes an InternalFrameListener from this JInternalFrame.
Parameters:
l - The listener to remove.

reshape

public void reshape(int x,
                    int y,
                    int width,
                    int height)
This method resizes and positions this JInternalFrame. It also forces a relayout of the Container.
Overrides:
reshape in interface JComponent
Parameters:
x - The x position of this JInternalFrame.
y - The y position of this JInternalFrame.
width - The width of this JInternalFrame.
height - The height of this JInternalFrame.

restoreSubcomponentFocus

public void restoreSubcomponentFocus()
This method gives focus to the last child Component that had focus. This is used by the UI when this JInternalFrame is activated.

setClosable

public void setClosable(boolean b)
This method sets whether this JInternalFrame can be closed.
Parameters:
b - Whether this JInternalFrame can be closed.

setClosed

public void setClosed(boolean b)
            throws PropertyVetoException
This method closes the JInternalFrame if the given boolean is true. If it is false, then the result of this method is unspecified. If the JInternalFrame is closed, this method does nothing. This method will first fire an INTERNAL_FRAME_CLOSING event and give a chance for veto listeners to cancel the close. If no listener vetoes the change, the closed property is set to true and the JInternalFrame is hidden and unselected. The method will finish by firing an INTERNAL_FRAME_CLOSED event.
Parameters:
b - Whether the JInternalFrame will be closed.
Throws:
PropertyVetoException - If a VetoableChangeListener vetoes the change.

setContentPane

public void setContentPane(Container c)
This method sets the Container to be used as a Content Pane for this JInternalFrame.
Specified by:
setContentPane in interface RootPaneContainer
Parameters:
c - The Container to use as a Content Pane.

setDefaultCloseOperation

public void setDefaultCloseOperation(int operation)
Sets a code for the action to be taken when this JInternalFrame is closed. Note that no validation is performed on the operation code, any integer will be accepted (nevertheless, you should pass in one of the listed values).

setDesktopIcon

public void setDesktopIcon(JInternalFrame.JDesktopIcon d)
Sets the JDesktopIcon instance that represents this JInternalFrame while it is iconified and, if the new icon is not the same instance as the existing icon, sends a PropertyChangeEvent (with the property name "desktopIcon") to all registered listeners..
Parameters:
d - the icon.

setFocusCycleRoot

public final void setFocusCycleRoot(boolean focusCycleRoot)
This method does nothing because this must be the root of a focus traversal cycle.
Overrides:
setFocusCycleRoot in interface Container
Parameters:
focusCycleRoot - Not used.

setFrameIcon

public void setFrameIcon(Icon icon)
This method sets the Icon to be used in two places. The first is icon that is painted at the top left corner of the JInternalFrame when it is not iconified (clicking on that icon will activate the TitlePane JMenuBar). When the JInternalFrame is iconified, it will be the icon displayed in the JDesktopIcon. If no icon is set, the JInternalFrame will use a Look and Feel default.
Parameters:
icon - The Icon used in the TitlePane JMenuBar and iconified frames.

setGlassPane

public void setGlassPane(Component glass)
This method sets the Glass Pane used with this JInternalFrame.
Specified by:
setGlassPane in interface RootPaneContainer
Parameters:
glass - The Glass Pane to use with this JInternalFrame.

setIcon

public void setIcon(boolean b)
            throws PropertyVetoException
This method iconifies or deiconifies this JInternalFrame given the boolean argument. If the JInternalFrame becomes iconified, it will fire an INTERNAL_FRAME_ICONIFIED event. If the JInternalFrame becomes deiconified, it will fire anINTERNAL_FRAME_DEICONIFIED event.
Parameters:
b - Whether this JInternalFrame is to be iconified or deiconified.
Throws:
PropertyVetoException - DOCUMENT ME!

setIconifiable

public void setIconifiable(boolean b)
This method sets whether the JInternalFrame can be iconified. (This means that the JInternalFrame can be turned into an icon if minimized).
Parameters:
b - Whether the JInternalFrame can be iconified.

setJMenuBar

public void setJMenuBar(JMenuBar b)
This method sets the JMenuBar to be used with this JInternalFrame.
Parameters:
b - The JMenuBar to be used with this JInternalFrame.

setLayer

public void setLayer(int layer)
A helper method that set the layer that this JInternalFrame resides in. Using this version of the method means that the user should not set it to values that are already defined in JLayeredPane. If predefined values are to be used, the user should use the setLayer(Integer) version.
Parameters:
layer - The layer to place this JInternalFrame in.

setLayer

public void setLayer(Integer layer)
A helper method that sets the layer that this JInternalFrame resides in. Calling this version of the method should use layer values that are already defined in JLayeredPane.
Parameters:
layer - The layer to place this JInternalFrame in.

setLayeredPane

public void setLayeredPane(JLayeredPane layered)
This method sets the JLayeredPane to use with this JInternalFrame.
Specified by:
setLayeredPane in interface RootPaneContainer
Parameters:
layered - The JLayeredPane to use as a layeredPane.

setLayout

public void setLayout(LayoutManager manager)
This method sets the Layout Manager used in the JInternalFrame. SetLayout should not be called on the JInternalFrame directly. Instead, it should be called with JInternalFrame.getContentPane().setLayout. Calls to this method with root pane checking enabled will cause exceptions to be thrown.
Overrides:
setLayout in interface Container
Parameters:
manager - The Layout Manager to be used with the JInternalFrame.

setMaximizable

public void setMaximizable(boolean b)
This method sets whether the JInternalFrame can be maximized.
Parameters:
b - Whether this JInternalFrame can be maximized.

setMaximum

public void setMaximum(boolean b)
            throws PropertyVetoException
This method sets the JInternalFrame to maximized (if the given argument is true) or restores the JInternalFrame to its normal bounds otherwise.
Parameters:
b - Whether this JInteralFrame will be maximized or restored.
Throws:
PropertyVetoException - If a VetoableChangeListener vetoes the change.

setMenuBar

public void setMenuBar(JMenuBar m)

Deprecated. 1.0.3

This method is deprecated. This method sets the JMenuBar used with this JInternalFrame.
Parameters:
m - The JMenuBar to use with this JInternalFrame.

setNormalBounds

public void setNormalBounds(Rectangle r)
This method sets the bounds that this JInternalFrame will be restored to.
Parameters:
r - The bounds that this JInternalFrame will be restored to.

setResizable

public void setResizable(boolean b)
This method sets whether the JInternalFrame can be resized by a user action (like dragging at the frame borders).
Parameters:
b - Whether this JInternalFramer can be resized.

setRootPane

protected void setRootPane(JRootPane root)
This method sets the Root Pane for this JInternalFrame.
Parameters:
root - The Root Pane for this JInternalFrame.

setRootPaneCheckingEnabled

protected void setRootPaneCheckingEnabled(boolean enabled)
This method sets whether root pane checking is enabled. If root pane checking is enabled, then calls to addImpl and setLayout will throw exceptions.
Parameters:
enabled - Whether root pane checking is enabled.

setSelected

public void setSelected(boolean selected)
            throws PropertyVetoException
This method sets whether this JInternalFrame is the selected frame in the JDesktopPane (or other container). When selected, a JInternalFrame will have focus and paint its TitlePane differently (usually a different colour). If this method selects the frame, this JInternalFrame will fire an INTERNAL_FRAME_ACTIVATED event. If it deselects this frame, it will fire an INTERNAL_FRAME_DEACTIVATED event.
Parameters:
selected - Whether this JInternalFrame will become selected or deselected.
Throws:
PropertyVetoException - If a VetoableChangeListener vetoes the change.

setTitle

public void setTitle(String title)
Sets the title for the JInternalFrame and sends a PropertyChangeEvent (with the property name TITLE_PROPERTY) to all registered listeners.
Parameters:
title - the new title (null permitted).
See Also:
getTitle()

setUI

public void setUI(InternalFrameUI ui)
This method is used to set the UI responsible for the JInternalFrame.
Parameters:
ui - The UI responsible for the JInternalFrame.

show

public void show()
This method displays the JInternalFrame. If it is not visible, this method will bring this JInternalFrame to the front, make it visible and select it. If this is the first time this JInternalFrame is made visible, an INTERNAL_FRAME_OPENED event will be fired.
Overrides:
show in interface Component

toBack

public void toBack()
This method causes the JInternalFrame to be brough to back in the z-order.

toFront

public void toFront()
This method causes the JInternalFrame to be brought to front in the z-order.

updateUI

public void updateUI()
This method resets the UI to the Look and Feel defaults.
Overrides:
updateUI in interface JComponent

JInternalFrame.java -- Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.