站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

Java(TM) 2 Platform, Standard Edition, v1.2.2 API Specification: Class JInternalFrame - JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

JavaTM 2 Platform
Standard Edition

javax.swing
Class JInternalFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JInternalFrame

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. Generally, you create an instance and add it to a JDesktopPane. Look and feel specific-actions are then (automatically??) delegated to the DesktopManager object maintained by the JDesktopPane (as set by the UI).

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
          The class used to obtain the accessible role for this object.
static class JInternalFrame.JDesktopIcon
          This component represents an iconified version of a JInternalFrame.
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
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
 
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.
protected  void fireInternalFrameEvent(int id)
           
 AccessibleContext getAccessibleContext()
          Get the AccessibleContext associated with this JComponent
 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.
 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().
 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 that 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 it's parent is a JLayeredPane.
 void moveToFront()
          Convenience method that moves this component to position 0 if it's 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, call 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 setClosable(boolean b)
          Set 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 deconizes the frame.
 void setIconifiable(boolean b)
          Set that the JInternalFrame can be made an icon by some user action.
 void setJMenuBar(JMenuBar m)
          Sets the JMenuBar for this JInternalFrame.
 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)
          Set 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 setResizable(boolean b)
          Set that the JInternalFrame can be resized by some user action.
protected  void setRootPane(JRootPane root)
          Set 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 setVisible(boolean b)
          Set the visible state of the object.
 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, 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, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, setCursor, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, 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, printAll, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, 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.
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.
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 that renders this component.
Overrides:
getUIClassID in class JComponent
Returns:
"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 rootPaneChecking 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:
 thiComponent.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
Throws:
Error - if called with rootPaneChecking 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.

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
Tags copied from interface: 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:
contentPane - 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
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:
layeredPane - 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
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
See Also:
RootPaneContainer.getRootPane()

setRootPane

protected void setRootPane(JRootPane root)
Set the rootPane property. This method is called by the constructor.

setVisible

public void setVisible(boolean b)
Set the visible state of the object.
Overrides:
setVisible in class JComponent
Parameters:
b - if true, shows this object; otherwise, hides it

setClosable

public void setClosable(boolean b)
Set 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 receiver.

setResizable

public void setResizable(boolean b)
Set 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)
Set 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 deconizes the frame.
Parameters:
b - a boolean, where true means to iconify the frame and false means to deiconify it
Throws:
PropertyVetoException - when the attempt to set the property is vetoed by the receiver.

setMaximizable

public void setMaximizable(boolean b)
Set 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 receiver.

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.
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 it's 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 it's parent is a JLayeredPane.

moveToBack

public void moveToBack()
Convenience method that moves this component to position -1 if it's 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

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)

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)

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:

  • DO_NOTHING_ON_CLOSE - do not do anything - require the program to handle the operation in the windowClosing method of a registered InternalFrameListener object.
  • HIDE_ON_CLOSE - automatically hide the window after invoking any registered InternalFrameListener objects
  • DISPOSE_ON_CLOSE - automatically hide and dispose the window after invoking any registered InternalFrameListener objects
  • EXIT_ON_CLOSE - Exit the application by way of System.exit. Only use this in applications.

The value is set to HIDE_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, call its paint method. We pass the delegate a copy of the Graphics object to protect the rest of the paint code from irrevocable changes (e.g. Graphics.translate()).
Overrides:
paintComponent in class JComponent
Tags copied from class: JComponent
See Also:
JComponent.paint(java.awt.Graphics)

getAccessibleContext

public AccessibleContext getAccessibleContext()
Get the AccessibleContext associated with this JComponent
Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class JComponent
Returns:
the AccessibleContext of this JComponent

JavaTM 2 Platform
Standard Edition

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