Spec-Zone .ru
спецификации, руководства, описания, API
JavaTM 2 Platform
Std. Ed. v1.3.1

javax.swing
Class JInternalFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JInternalFrame
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, RootPaneContainer, Serializable, WindowConstants

public class JInternalFrame
extends JComponent
implements Accessible, WindowConstants, RootPaneContainer

A lightweight object that provides many of the features of a native frame, including dragging, closing, becoming an icon, resizing, title display, and support for a menu bar. For task-oriented documentation and examples of using internal frames, see How to Use Internal Frames, a section in The Java Tutorial.

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

The JInternalFrame contentPane is where you add child components. So, to create a JInternalFrame that has a number of buttons arranged with a BorderLayout object, you might do something like this:

    JComponent c = (JComponent) frame.getContentPane();
    c.setLayout(new BorderLayout());
    c.add(new JButton(), BorderLayout.NORTH);
    c.add(new JButton(), BorderLayout.CENTER);
 
The contentPane is actually managed by an instance of JRootPane, which also manages a layoutPane, glassPane, and optional menuBar for the frame. Please see the JRootPane documentation for a complete description of these components.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions, see the JInternalFrame key assignments.

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. A future release of Swing will provide support for long term persistence.

See Also:
JDesktopPane, DesktopManager, JInternalFrame.JDesktopIcon, JRootPane, Serialized Form

Inner Class Summary
protected  class JInternalFrame.AccessibleJInternalFrame
          This class implements accessibility support for the JInternalFrame class.
static class JInternalFrame.JDesktopIcon
          This component represents an iconified version of a JInternalFrame.
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
Component.AccessibleAWTComponent
 
Field Summary
protected  boolean closable
          The frame can be closed.
static String CONTENT_PANE_PROPERTY
          Bound property name.
protected  JInternalFrame.JDesktopIcon desktopIcon
          The icon that is displayed when the frame is iconized.
static String FRAME_ICON_PROPERTY
          Bound property name.
protected  Icon frameIcon
          The icon shown in the top-left corner of the frame.
static String GLASS_PANE_PROPERTY
          Bound property name.
protected  boolean iconable
          The frame can "iconized" (shrunk down and displayed as an icon-image).
static String IS_CLOSED_PROPERTY
          Constrained property name indicating that the frame is closed.
static String IS_ICON_PROPERTY
          Constrained property name indicating that the frame is iconified.
static String IS_MAXIMUM_PROPERTY
          Constrained property name indicating that the frame is maximized.
static String IS_SELECTED_PROPERTY
          Constrained property name indicated that this frame has selected status.
protected  boolean isClosed
          The frame has been closed.
protected  boolean isIcon
          The frame has been iconized.
protected  boolean isMaximum
          The frame has been expanded to its maximum size.
protected  boolean isSelected
          The frame is currently selected.
static String LAYERED_PANE_PROPERTY
          Bound property name.
protected  boolean maximizable
          The frame can be expanded to the size of the desktop pane.
static String MENU_BAR_PROPERTY
          Bound property name.
protected  boolean resizable
          The frame's size can be changed.
static String ROOT_PANE_PROPERTY
          Bound property name.
protected  JRootPane rootPane
          The JRootPane instance that manages the contentPane and optional menuBar for this frame, as well as the glassPane.
protected  boolean rootPaneCheckingEnabled
          If true then calls to add and setLayout cause an exception to be thrown.
protected  String title
          The title displayed in the frame's title bar.
static String TITLE_PROPERTY
          Bound property name.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JInternalFrame()
          Creates a non-resizable, non-closable, non-maximizable, non-iconifiable JInternalFrame with no title.
JInternalFrame(String title)
          Creates a non-resizable, non-closable, non-maximizable, non-iconifiable JInternalFrame with the specified title.
JInternalFrame(String title, boolean resizable)
          Creates a non-closable, non-maximizable, non-iconifiable JInternalFrame with the specified title and with resizability specified.
JInternalFrame(String title, boolean resizable, boolean closable)
          Creates a non-maximizable, non-iconifiable JInternalFrame with the specified title and with resizability and closability specified.
JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable)
          Creates a non-iconifiable JInternalFrame with the specified title and with resizability, closability, and maximizability specified.
JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable)
          Creates a JInternalFrame with the specified title and with resizability, closability, maximizability, and iconifiability specified.
 
Method Summary
protected  void addImpl(Component comp, Object constraints, int index)
          By default, children may not be added directly to a this component, they must be added to its contentPane instead.
 void addInternalFrameListener(InternalFrameListener l)
          Adds the specified internal frame listener to receive internal frame events from this internal frame.
protected  JRootPane createRootPane()
          Called by the constructor to set up the JRootPane.
 void dispose()
          Disposes of this internal frame.
 void doDefaultCloseAction()
           
protected  void fireInternalFrameEvent(int id)
           
 AccessibleContext getAccessibleContext()
          Gets the AccessibleContext associated with this JInternalFrame.
 Container getContentPane()
          Returns the contentPane.
 int getDefaultCloseOperation()
          Returns the default operation which occurs when the user initiates a "close" on this window.
 JInternalFrame.JDesktopIcon getDesktopIcon()
          Returns the JDesktopIcon used when this JInternalFrame is iconified.
 JDesktopPane getDesktopPane()
          Convenience method that searchs the anscestor heirarchy for a JDesktop instance.
 Component getFocusOwner()
          If this JInternalFrame is active, return the child which has focus.
 Icon getFrameIcon()
          Returns the image displayed in the title bar of the frame (usually in the top-left corner).
 Component getGlassPane()
          Returns the glassPane object for this frame.
 JMenuBar getJMenuBar()
          Returns the current JMenuBar for this JInternalFrame, or null if no menu bar has been set.
 int getLayer()
          Convenience method for getting the layer attribute of this component.
 JLayeredPane getLayeredPane()
          Returns the layeredPane object for this frame.
 JMenuBar getMenuBar()
          Deprecated. As of Swing version 1.0.3, replaced by getJMenuBar().
 Rectangle getNormalBounds()
          If the JInternalFrame is not in maximized state, return getBounds(); otherwise, return the bounds that the JInternalFrame would be restored to.
 JRootPane getRootPane()
          Returns the rootPane object for this frame.
 String getTitle()
          Returns the title of the JInternalFrame.
 InternalFrameUI getUI()
          Returns the L&F object that renders this component.
 String getUIClassID()
          Returns the name of the L&F class which renders this component.
 String getWarningString()
          Gets the warning string that is displayed with this window.
 boolean isClosable()
          Returns whether this JInternalFrame be closed by some user action.
 boolean isClosed()
          Returns whether this JInternalFrame is currently closed.
 boolean isIcon()
          Returns whether the JInternalFrame is currently iconified.
 boolean isIconifiable()
          Returns whether the JInternalFrame can be iconified by some user action.
 boolean isMaximizable()
          Returns whether the JInternalFrame can be maximized by some user action.
 boolean isMaximum()
          Returns whether the JInternalFrame is currently maximized.
 boolean isResizable()
          Returns whether the JInternalFrame can be resized by some user action.
protected  boolean isRootPaneCheckingEnabled()
          Returns whether calls to add and setLayout cause an exception to be thrown.
 boolean isSelected()
          Returns whether the JInternalFrame is the currently "selected" or active frame.
 void moveToBack()
          Convenience method that moves this component to position -1 if its parent is a JLayeredPane.
 void moveToFront()
          Convenience method that moves this component to position 0 if its parent is a JLayeredPane.
 void pack()
          Causes subcomponents of this JInternalFrame to be laid out at their preferred size.
protected  void paintComponent(Graphics g)
          If the UI delegate is non-null, calls its paint method.
protected  String paramString()
          Returns a string representation of this JInternalFrame.
 void remove(Component comp)
          Removes the specified component from this container.
 void removeInternalFrameListener(InternalFrameListener l)
          Removes the specified internal frame listener so that it no longer receives internal frame events from this internal frame.
 void reshape(int x, int y, int width, int height)
          Moves and resizes this component.
 void restoreSubcomponentFocus()
          This method directs the internal frame to restore focus to the last subcomponent that had focus.
 void setClosable(boolean b)
          Sets that this JInternalFrame can be closed by some user action.
 void setClosed(boolean b)
          Calling this method with a value of true to close the frame.
 void setContentPane(Container c)
          Sets this JInternalFrame's content pane.
 void setDefaultCloseOperation(int operation)
          Sets the operation which will happen by default when the user initiates a "close" on this window.
 void setDesktopIcon(JInternalFrame.JDesktopIcon d)
          Sets the JDesktopIcon associated with this JInternalFrame.
 void setFrameIcon(Icon icon)
          Sets an image to be displayed in the titlebar of the frame (usually in the top-left corner).
 void setGlassPane(Component glass)
          Sets this JInternalFrame's glassPane property.
 void setIcon(boolean b)
          Iconizes and de-iconizes the frame.
 void setIconifiable(boolean b)
          Sets that the JInternalFrame can be made an icon by some user action.
 void setJMenuBar(JMenuBar m)
          Sets the JMenuBar for this JInternalFrame.
 void setLayer(int layer)
          Convenience method for setting the layer attribute of this component.
 void setLayer(Integer layer)
          Convenience method for setting the layer attribute of this component.
 void setLayeredPane(JLayeredPane layered)
          Sets this JInternalFrame's layeredPane property.
 void setLayout(LayoutManager manager)
          By default the layout of this component may not be set, the layout of its contentPane should be set instead.
 void setMaximizable(boolean b)
          Sets that the JInternalFrame can be maximized by some user action.
 void setMaximum(boolean b)
          Maximizes and restores the frame.
 void setMenuBar(JMenuBar m)
          Deprecated. As of Swing version 1.0.3 replaced by setJMenuBar(JMenuBar m).
 void setNormalBounds(Rectangle r)
          Sets the normal bounds for this frame, the bounds that the frame would be restored to from its maximized state.
 void setResizable(boolean b)
          Sets that the JInternalFrame can be resized by some user action.
protected  void setRootPane(JRootPane root)
          Sets the rootPane property.
protected  void setRootPaneCheckingEnabled(boolean enabled)
          Determines whether calls to add and setLayout cause an exception to be thrown.
 void setSelected(boolean selected)
          Selects and deselects the JInternalFrame.
 void setTitle(String title)
          Sets the JInternalFrame title.
 void setUI(InternalFrameUI ui)
          Sets the UI delegate for this JInternalFrame.
 void show()
          Shows this internal frame, and brings it to the front.
 void toBack()
          Sends this internal frame to the back.
 void toFront()
          Brings this internal frame to the front.
 void updateUI()
          Notification from the UIManager that the L&F has changed.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rootPane

protected JRootPane rootPane
The JRootPane instance that manages the contentPane and optional menuBar for this frame, as well as the glassPane.
See Also:
JRootPane, RootPaneContainer

rootPaneCheckingEnabled

protected boolean rootPaneCheckingEnabled
If true then calls to add and setLayout cause an exception to be thrown.

closable

protected boolean closable
The frame can be closed.

isClosed

protected boolean isClosed
The frame has been closed.

maximizable

protected boolean maximizable
The frame can be expanded to the size of the desktop pane.

isMaximum

protected boolean isMaximum
The frame has been expanded to its maximum size.
See Also:
maximizable

iconable

protected boolean iconable
The frame can "iconized" (shrunk down and displayed as an icon-image).
See Also:
JInternalFrame.JDesktopIcon

isIcon

protected boolean isIcon
The frame has been iconized.
See Also:
iconable

resizable

protected boolean resizable
The frame's size can be changed.

isSelected

protected boolean isSelected
The frame is currently selected.

frameIcon

protected Icon frameIcon
The icon shown in the top-left corner of the frame.

title

protected String title
The title displayed in the frame's title bar.

desktopIcon

protected JInternalFrame.JDesktopIcon desktopIcon
The icon that is displayed when the frame is iconized.
See Also:
iconable

CONTENT_PANE_PROPERTY

public static final String CONTENT_PANE_PROPERTY
Bound property name.

MENU_BAR_PROPERTY

public static final String MENU_BAR_PROPERTY
Bound property name.

TITLE_PROPERTY

public static final String TITLE_PROPERTY
Bound property name.

LAYERED_PANE_PROPERTY

public static final String LAYERED_PANE_PROPERTY
Bound property name.

ROOT_PANE_PROPERTY

public static final String ROOT_PANE_PROPERTY
Bound property name.

GLASS_PANE_PROPERTY

public static final String GLASS_PANE_PROPERTY
Bound property name.

FRAME_ICON_PROPERTY

public static final String FRAME_ICON_PROPERTY
Bound property name.

IS_SELECTED_PROPERTY

public static final String IS_SELECTED_PROPERTY
Constrained property name indicated that this frame has selected status.

IS_CLOSED_PROPERTY

public static final String IS_CLOSED_PROPERTY
Constrained property name indicating that the frame is closed.

IS_MAXIMUM_PROPERTY

public static final String IS_MAXIMUM_PROPERTY
Constrained property name indicating that the frame is maximized.

IS_ICON_PROPERTY

public static final String IS_ICON_PROPERTY
Constrained property name indicating that the frame is iconified.
Constructor Detail

JInternalFrame

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

JInternalFrame

public JInternalFrame(String title)
Creates a non-resizable, non-closable, non-maximizable, non-iconifiable JInternalFrame with the specified title.
Parameters:
title - the String to display in the title bar

JInternalFrame

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

JInternalFrame

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

JInternalFrame

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

JInternalFrame

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

createRootPane

protected JRootPane createRootPane()
Called by the constructor to set up the JRootPane.
Returns:
a new JRootPane
See Also:
JRootPane

getUI

public InternalFrameUI getUI()
Returns the L&F object that renders this component.
Returns:
the InternalFrameUI object that renders this component

setUI

public void setUI(InternalFrameUI ui)
Sets the UI delegate for this JInternalFrame.

updateUI

public void updateUI()
Notification from the UIManager that the L&F has changed. Replaces the current UI object with the latest version from the UIManager.
Overrides:
updateUI in class JComponent
See Also:
JComponent.updateUI()

getUIClassID

public String getUIClassID()
Returns the name of the L&F class which renders this component.
Overrides:
getUIClassID in class JComponent
Returns:
the string "InternalFrameUI"
See Also:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

isRootPaneCheckingEnabled

protected boolean isRootPaneCheckingEnabled()
Returns whether calls to add and setLayout cause an exception to be thrown.
Returns:
true if add and setLayout are checked
See Also:
addImpl(java.awt.Component, java.lang.Object, int), setLayout(java.awt.LayoutManager), setRootPaneCheckingEnabled(boolean)

setRootPaneCheckingEnabled

protected void setRootPaneCheckingEnabled(boolean enabled)
Determines whether calls to add and setLayout cause an exception to be thrown.
Parameters:
enabled - a boolean value, true if checking is to be enabled, which cause the exceptions to be thrown
See Also:
addImpl(java.awt.Component, java.lang.Object, int), setLayout(java.awt.LayoutManager), isRootPaneCheckingEnabled()

addImpl

protected void addImpl(Component comp,
                       Object constraints,
                       int index)
By default, children may not be added directly to a this component, they must be added to its contentPane instead. For example:
 thisComponent.getContentPane().add(child)
 
An attempt to add to directly to this component will cause an runtime exception to be thrown. Subclasses can disable this behavior.
Overrides:
addImpl in class Container
Throws:
Error - if called with isRootPaneChecking true
See Also:
setRootPaneCheckingEnabled(boolean)

remove

public void remove(Component comp)
Removes the specified component from this container.
Overrides:
remove in class Container
Parameters:
comp - the component to be removed
See Also:
Container.add(java.awt.Component)

setLayout

public void setLayout(LayoutManager manager)
By default the layout of this component may not be set, the layout of its contentPane should be set instead. For example:
 thisComponent.getContentPane().setLayout(new BorderLayout())
 
An attempt to set the layout of this component will cause an runtime exception to be thrown. Subclasses can disable this behavior.
Overrides:
setLayout in class Container
Parameters:
manager - the LayoutManager
Throws:
Error - if called with isRootPaneChecking true
See Also:
setRootPaneCheckingEnabled(boolean)

getMenuBar

public JMenuBar getMenuBar()
Deprecated. As of Swing version 1.0.3, replaced by getJMenuBar().

Returns the current JMenuBar for this JInternalFrame, or null if no menu bar has been set.
Returns:
the current menubar or null if none has been set

getJMenuBar

public JMenuBar getJMenuBar()
Returns the current JMenuBar for this JInternalFrame, or null if no menu bar has been set.
Returns:
the JMenuBar used by this frame
See Also:
setJMenuBar(javax.swing.JMenuBar)

setMenuBar

public void setMenuBar(JMenuBar m)
Deprecated. As of Swing version 1.0.3 replaced by setJMenuBar(JMenuBar m).

Sets the JMenuBar for this JInternalFrame.
Parameters:
m - the JMenuBar to use in this frame
See Also:
getJMenuBar()

setJMenuBar

public void setJMenuBar(JMenuBar m)
Sets the JMenuBar for this JInternalFrame.
Parameters:
m - the JMenuBar to use in this frame
See Also:
getJMenuBar()

getContentPane

public Container getContentPane()
Description copied from interface: RootPaneContainer
Returns the contentPane.
Specified by:
getContentPane in interface RootPaneContainer
Following copied from interface: javax.swing.RootPaneContainer
Returns:
the value of the contentPane property.
See Also:
RootPaneContainer.setContentPane(java.awt.Container)

setContentPane

public void setContentPane(Container c)
Sets this JInternalFrame's content pane.
Specified by:
setContentPane in interface RootPaneContainer
Parameters:
c - the contentPane object for this frame
Throws:
IllegalComponentStateException - (a runtime exception) if the content pane parameter is null
See Also:
RootPaneContainer.getContentPane()

getLayeredPane

public JLayeredPane getLayeredPane()
Returns the layeredPane object for this frame.
Specified by:
getLayeredPane in interface RootPaneContainer
Returns:
the layeredPane object
See Also:
RootPaneContainer.setLayeredPane(javax.swing.JLayeredPane), RootPaneContainer.getLayeredPane()

setLayeredPane

public void setLayeredPane(JLayeredPane layered)
Sets this JInternalFrame's layeredPane property.
Specified by:
setLayeredPane in interface RootPaneContainer
Parameters:
layered - the layeredPane object for this frame
Throws:
IllegalComponentStateException - (a runtime exception) if the layered pane parameter is null
See Also:
RootPaneContainer.setLayeredPane(javax.swing.JLayeredPane)

getGlassPane

public Component getGlassPane()
Returns the glassPane object for this frame.
Specified by:
getGlassPane in interface RootPaneContainer
Returns:
the glassPane object
See Also:
RootPaneContainer.setGlassPane(java.awt.Component)

setGlassPane

public void setGlassPane(Component glass)
Sets this JInternalFrame's glassPane property.
Specified by:
setGlassPane in interface RootPaneContainer
Parameters:
glassPane - the glassPane object for this frame
See Also:
RootPaneContainer.getGlassPane()

getRootPane

public JRootPane getRootPane()
Returns the rootPane object for this frame.
Specified by:
getRootPane in interface RootPaneContainer
Overrides:
getRootPane in class JComponent
Returns:
the rootPane property
See Also:
RootPaneContainer.getRootPane()

setRootPane

protected void setRootPane(JRootPane root)
Sets the rootPane property. This method is called by the constructor.
Parameters:
root - the new rootPane object

setClosable

public void setClosable(boolean b)
Sets that this JInternalFrame can be closed by some user action.
Parameters:
b - a boolean value, where true means the frame can be closed

isClosable

public boolean isClosable()
Returns whether this JInternalFrame be closed by some user action.
Returns:
true if the frame can be closed

isClosed

public boolean isClosed()
Returns whether this JInternalFrame is currently closed.
Returns:
true if the frame is closed

setClosed

public void setClosed(boolean b)
               throws PropertyVetoException
Calling this method with a value of true to close the frame.
Parameters:
b - a boolean, where true means "close the frame"
Throws:
PropertyVetoException - when the attempt to set the property is vetoed by the JInternalFrame

setResizable

public void setResizable(boolean b)
Sets that the JInternalFrame can be resized by some user action.
Parameters:
b - a boolean, where true means the frame can be resized

isResizable

public boolean isResizable()
Returns whether the JInternalFrame can be resized by some user action.
Returns:
true if the frame can be resized

setIconifiable

public void setIconifiable(boolean b)
Sets that the JInternalFrame can be made an icon by some user action.
Parameters:
b - a boolean, where true means the frame can be iconified

isIconifiable

public boolean isIconifiable()
Returns whether the JInternalFrame can be iconified by some user action.
Returns:
true if the frame can be iconified

isIcon

public boolean isIcon()
Returns whether the JInternalFrame is currently iconified.
Returns:
true if the frame is iconified

setIcon

public void setIcon(boolean b)
             throws PropertyVetoException
Iconizes and de-iconizes the frame.
Parameters:
b - a boolean, where true means to iconify the frame and false means to de-iconify it
Throws:
PropertyVetoException - when the attempt to set the property is vetoed by the JInternalFrame

setMaximizable

public void setMaximizable(boolean b)
Sets that the JInternalFrame can be maximized by some user action.
Parameters:
b - a boolean where true means the frame can be maximized

isMaximizable

public boolean isMaximizable()
Returns whether the JInternalFrame can be maximized by some user action.
Returns:
true if the frame can be maximized

isMaximum

public boolean isMaximum()
Returns whether the JInternalFrame is currently maximized.
Returns:
true if the frame is maximized

setMaximum

public void setMaximum(boolean b)
                throws PropertyVetoException
Maximizes and restores the frame. A maximized frame is resized to fully fit the JDesktopPane area associated with the JInternalFrame. A restored frame's size is set to the JInternalFrame's actual size.
Parameters:
b - a boolean, where true maximizes the frame and false restores it
Throws:
PropertyVetoException - when the attempt to set the property is vetoed by the JInternalFrame

getTitle

public String getTitle()
Returns the title of the JInternalFrame.
Returns:
a String containing the frame's title
See Also:
setTitle(java.lang.String)

setTitle

public void setTitle(String title)
Sets the JInternalFrame title. title may have a null value.
Parameters:
title - the String to display in the title bar
See Also:
getTitle()

setSelected

public void setSelected(boolean selected)
                 throws PropertyVetoException
Selects and deselects the JInternalFrame. A JInternalFrame normally draws its title bar differently if it is the selected frame, which indicates to the user that this internalFrame has the focus.
Parameters:
selected - a boolean, where true means the frame is selected (currently active) and false means it is not
Throws:
PropertyVetoException - when the attempt to set the property is vetoed by the receiver.

isSelected

public boolean isSelected()
Returns whether the JInternalFrame is the currently "selected" or active frame.
Returns:
true if the frame is currently selected (active)
See Also:
setSelected(boolean)

setFrameIcon

public void setFrameIcon(Icon icon)
Sets an image to be displayed in the titlebar of the frame (usually in the top-left corner). This image is not the desktopIcon object, which is the image displayed in the JDesktop when the frame is iconified. Passing null to this function is valid, but the L&F can choose the appropriate behavior for that situation, such as displaying no icon or a default icon for the L&F.
Parameters:
icon - the Icon to display in the title bar
See Also:
getFrameIcon()

getFrameIcon

public Icon getFrameIcon()
Returns the image displayed in the title bar of the frame (usually in the top-left corner).
Returns:
the Icon displayed in the title bar
See Also:
setFrameIcon(javax.swing.Icon)

moveToFront

public void moveToFront()
Convenience method that moves this component to position 0 if its parent is a JLayeredPane.

moveToBack

public void moveToBack()
Convenience method that moves this component to position -1 if its parent is a JLayeredPane.

setLayer

public void setLayer(Integer layer)
Convenience method for setting the layer attribute of this component.
Parameters:
layer - an Integer object specifying this frame's desktop layer
See Also:
JLayeredPane

setLayer

public void setLayer(int layer)
Convenience method for setting the layer attribute of this component. The method setLayer(Integer) should be used for layer values predefined in JLayeredPane. When using setLayer(int), care must be taken not to accidentally clash with those values.
Parameters:
layer - an int specifying this frame's desktop layer
See Also:
setLayer(Integer), JLayeredPane

getLayer

public int getLayer()
Convenience method for getting the layer attribute of this component.
Returns:
an Integer object specifying this frame's desktop layer
See Also:
JLayeredPane

getDesktopPane

public JDesktopPane getDesktopPane()
Convenience method that searchs the anscestor heirarchy for a JDesktop instance. If JInternalFrame finds none, the desktopIcon tree is searched.
Returns:
the JDesktopPane this frame belongs to, or null if none is found

setDesktopIcon

public void setDesktopIcon(JInternalFrame.JDesktopIcon d)
Sets the JDesktopIcon associated with this JInternalFrame.
Parameters:
d - the JDesktopIcon to display on the desktop
See Also:
getDesktopIcon()

getDesktopIcon

public JInternalFrame.JDesktopIcon getDesktopIcon()
Returns the JDesktopIcon used when this JInternalFrame is iconified.
Returns:
the JDesktopIcon displayed on the desktop
See Also:
setDesktopIcon(javax.swing.JInternalFrame.JDesktopIcon)

getNormalBounds

public Rectangle getNormalBounds()
If the JInternalFrame is not in maximized state, return getBounds(); otherwise, return the bounds that the JInternalFrame would be restored to.
Returns:
the bounds of this frame when in the normal state
Since:
1.3

setNormalBounds

public void setNormalBounds(Rectangle r)
Sets the normal bounds for this frame, the bounds that the frame would be restored to from its maximized state. This method is intended for use only by desktop managers.
Parameters:
r - the bounds that the frame should be restored to
Since:
1.3

getFocusOwner

public Component getFocusOwner()
If this JInternalFrame is active, return the child which has focus. Otherwise, return null.

At present, this method works only for JComponent children.

Returns:
the component with focus, or null if no children have focus assigned to them.
Since:
1.3

restoreSubcomponentFocus

public void restoreSubcomponentFocus()
This method directs the internal frame to restore focus to the last subcomponent that had focus. This is used by the UI when the user selected the frame, e.g., by clicking on the title bar.
Since:
1.3

reshape

public 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:
reshape in class JComponent
Parameters:
x - an int giving the component's new horizontal position measured in pixels from the left of its container
y - an int giving the component's new vertical position, measured in pixels from the bottom of its container
width - an int giving the component's new width in pixels
height - an int giving the component's new height in pixels

addInternalFrameListener

public void addInternalFrameListener(InternalFrameListener l)
Adds the specified internal frame listener to receive internal frame events from this internal frame.
Parameters:
l - the internal frame listener

removeInternalFrameListener

public void removeInternalFrameListener(InternalFrameListener l)
Removes the specified internal frame listener so that it no longer receives internal frame events from this internal frame.
Parameters:
l - the internal frame listener

fireInternalFrameEvent

protected void fireInternalFrameEvent(int id)

doDefaultCloseAction

public void doDefaultCloseAction()

setDefaultCloseOperation

public void setDefaultCloseOperation(int operation)
Sets the operation which will happen by default when the user initiates a "close" on this window. The possible choices are:

The value is set to DISPOSE_ON_CLOSE by default.

See Also:
addInternalFrameListener(javax.swing.event.InternalFrameListener), getDefaultCloseOperation()

getDefaultCloseOperation

public int getDefaultCloseOperation()
Returns the default operation which occurs when the user initiates a "close" on this window.
See Also:
setDefaultCloseOperation(int)

pack

public void pack()
Causes subcomponents of this JInternalFrame to be laid out at their preferred size.
See Also:
Window.pack()

show

public void show()
Shows this internal frame, and brings it to the front.

If this window is not yet visible, show makes it visible. If this window is already visible, then this method brings it to the front.

Overrides:
show in class Component
See Also:
Window.show(), Window.toFront(), Component.setVisible(boolean)

dispose

public void dispose()
Disposes of this internal frame. If the frame is not already closed, a frame-closed event is posted.

toFront

public 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 windows.
See Also:
Window.toFront(), moveToFront()

toBack

public 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 windows.
See Also:
Window.toBack(), moveToBack()

getWarningString

public final String getWarningString()
Gets the warning string that is displayed with this window. Since an internal frame is always secure (since it's fully contained within a window which might need a warning string) this method always returns null.
Returns:
null
See Also:
Window.getWarningString()

paramString

protected String paramString()
Returns a string representation of this JInternalFrame. 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 be null.
Overrides:
paramString in class JComponent
Returns:
a string representation of this JInternalFrame.

paintComponent

protected void paintComponent(Graphics g)
Description copied from class: JComponent
If the UI delegate is non-null, calls its paint method. We pass the delegate a copy of the Graphics object to protect the rest of the paint code from irrevocable changes (for example, Graphics.translate()).
Overrides:
paintComponent in class JComponent
Following copied from class: javax.swing.JComponent
See Also:
JComponent.paint(java.awt.Graphics)

getAccessibleContext

public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this JInternalFrame. For internal frames, the AccessibleContext takes the form of an AccessibleJInternalFrame. A new AccessibleJInternalFrame instance is created if necessary.
Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class JComponent
Returns:
an AccessibleJInternalFrame that serves as the AccessibleContext of this JInternalFrame

JavaTM 2 Platform
Std. Ed. v1.3.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.

free hit counter