All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.JInternalFrame

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

public class JInternalFrame
extends JComponent
implements Accessible, MouseListener, MouseMotionListener, WindowConstants, RootPaneContainer, ComponentListener
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 will create an instance and add it to a JDesktopPane.

The JInternalFrame has a 'contentPane' that is used to describe the area of the component where normal child components should be placed. So, if you wanted build a JInternalFrame that had a number of buttons arranged through a BorderLayout object, you might do something like:

    JComponent c = frame.getContentPane();
    c.setLayoutManager(new BorderLayout());
    c.add(new JButton(), BorderLayout.NORTH);
    c.add(new JButton(), BorderLayout.CENTER);
 
 

Please see the JRootPane documentation for a complete description of the contentPane(), glassPane(), and layeredPane() components.

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 Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.

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

Variable Index

 o closable
 o CONTENT_PANE_PROPERTY
Bound property name.
 o desktopIcon
 o frameIcon
 o GLASS_PANE_PROPERTY
Bound property name.
 o iconable
 o IS_CLOSED_PROPERTY
Constrained property name indicating that the frame is closed.
 o IS_ICON_PROPERTY
Constrained property name indicating that the frame is iconified.
 o IS_MAXIMUM_PROPERTY
Constrained property name indicating that the frame is maximized.
 o IS_SELECTED_PROPERTY
Constrained property name indicated that this frame has selected status.
 o isClosed
 o isIcon
 o isMaximum
 o isSelected
 o LAYERED_PANE_PROPERTY
Bound property name.
 o maximizable
 o MENU_BAR_PROPERTY
Bound property name.
 o resizable
 o ROOT_PANE_PROPERTY
Bound property name.
 o rootPane
 o rootPaneCheckingEnabled
 o title
 o TITLE_PROPERTY
Bound property name.

Constructor Index

 o JInternalFrame()
Creates a JInternalFrame with no title, and all boolean setting false.
 o JInternalFrame(String)
Creates a JInternalFrame with title, and all boolean setting false.
 o JInternalFrame(String, boolean)
 o JInternalFrame(String, boolean, boolean)
 o JInternalFrame(String, boolean, boolean, boolean)
 o JInternalFrame(String, boolean, boolean, boolean, boolean)
Primitive creation method that sets the appropriate values.

Method Index

 o addImpl(Component, Object, int)
By default, children may not be added directly to a this component, they must be added to its contentPane instead.
 o addInternalFrameListener(InternalFrameListener)
Adds the specified internal frame listener to receive internal frame events from this internal frame.
 o componentHidden(ComponentEvent)
 o componentMoved(ComponentEvent)
 o componentResized(ComponentEvent)
Invoked when a maximized JInternalFrame's parent's size changes.
 o componentShown(ComponentEvent)
 o createRootPane()
 o dispose()
Disposes of this internal frame.
 o getAccessibleContext()
Get the AccessibleContext associated with this JComponent
 o getBackground()
Get the background color of this object.
 o getContentPane()
 o getDefaultCloseOperation()
Returns the default operation which occurs when the user initiates a "close" on this window.
 o getDesktopIcon()
Returns the JDesktopIcon used when this JInternalFrame is iconified.
 o getDesktopPane()
Convenience method that searchs the anscestor heirarchy for a JDesktop instance.
 o getForeground()
Get the foreground color of this object.
 o getFrameIcon()
 o getGlassPane()
 o getLayer()
Convenience method for getting the layer attribute of this component.
 o getLayeredPane()
 o getMenuBar()
Returns the current JMenuBar for this JInternalFrame, or null if no menu bar has been set.
 o getRootPane()
 o getTitle()
Returns the current JInternalFrame title.
 o getUI()
 o getUIClassID()
 o getWarningString()
Gets the warning string that is displayed with this window.
 o isClosable()
Returns whether this JInternalFrame be closed by some user action.
 o isClosed()
 o isIcon()
 o isIconifiable()
 o isMaximizable()
 o isMaximum()
 o isResizable()
 o isRootPaneCheckingEnabled()
 o isSelected()
 o mouseClicked(MouseEvent)
 o mouseDragged(MouseEvent)
 o mouseEntered(MouseEvent)
 o mouseExited(MouseEvent)
 o mouseMoved(MouseEvent)
 o mousePressed(MouseEvent)
 o mouseReleased(MouseEvent)
 o moveToBack()
Convenience method that moves this component to position -1 if it's parent is a JLayeredPane.
 o moveToFront()
Convenience method that moves this component to position 0 if it's parent is a JLayeredPane.
 o pack()
Causes subcomponents of this JInternalFrame to be laid out at their preferred size.
 o processEvent(AWTEvent)
Processes events on this internal frame.
 o removeInternalFrameListener(InternalFrameListener)
Removes the specified internal frame listener so that it no longer receives internal frame events from this internal frame.
 o reshape(int, int, int, int)
Moves and resizes this component.
 o setBackground(Color)
Set the background color of this object.
 o setClosable(boolean)
Set that this JInternalFrame can be closed by some user action.
 o setClosed(boolean)
Calling this method with true, will cause the frame to close.
 o setContentPane(Container)
Sets this JInternalFrame's content pane.
 o setDefaultCloseOperation(int)
Sets the operation which will happen by default when the user initiates a "close" on this window.
 o setDesktopIcon(JInternalFrame. JDesktopIcon)
Sets the JDesktopIcon associated with this JInternalFrame.
 o setForeground(Color)
Set the foreground color of this object.
 o setFrameIcon(Icon)
Sets an image to be displayed in the titlebar of the frame.
 o setGlassPane(Component)
 o setIcon(boolean)
Setting this property to true will iconify the frame, false will deiconify.
 o setIconifiable(boolean)
Set that the JInternalFrame can be made an icon by some user action.
 o setLayer(Integer)
Convenience method for setting the layer attribute of this component.
 o setLayeredPane(JLayeredPane)
 o setLayout(LayoutManager)
By default the layout of this component may not be set, the layout of its contentPane should be set instead.
 o setMaximizable(boolean)
Set that the JInternalFrame can be maximized by some user action.
 o setMaximum(boolean)
Setting this property to true will maximize the frame, false will minimize.
 o setMenuBar(JMenuBar)
Sets the JMenuBar for this JInternalFrame.
 o setResizable(boolean)
Set that the JInternalFrame resizable by some user action.
 o setRootPane(JRootPane)
Set the rootPane property.
 o setRootPaneCheckingEnabled(boolean)
If true then calls to add() and setLayout() will cause an exception to be thrown.
 o setSelected(boolean)
A JInternalFrame normally draws it's title bar differently if it is the selected frame.
 o setTitle(String)
Sets the JInternalFrame title.
 o setUI(InternalFrameUI)
Sets the UI delegate for this JInternalFrame.
 o setVisible(boolean)
Set the visible state of the object.
 o show()
Shows this internal frame, and brings it to the front.
 o toBack()
Sends this internal frame to the back.
 o toFront()
Brings this internal frame to the front.
 o updateUI()
Resets the UI property to a value from the current look and feel.

Variables

 o rootPane
 protected JRootPane rootPane
See Also:
getRootPane, setRootPane
 o rootPaneCheckingEnabled
 protected boolean rootPaneCheckingEnabled
See Also:
isRootPaneCheckingEnabled, setRootPaneCheckingEnabled
 o closable
 protected boolean closable
 o isClosed
 protected boolean isClosed
 o maximizable
 protected boolean maximizable
 o isMaximum
 protected boolean isMaximum
 o iconable
 protected boolean iconable
 o isIcon
 protected boolean isIcon
 o resizable
 protected boolean resizable
 o isSelected
 protected boolean isSelected
 o frameIcon
 protected Icon frameIcon
 o title
 protected String title
 o desktopIcon
 protected JInternalFrame. JDesktopIcon desktopIcon
 o CONTENT_PANE_PROPERTY
 public static final String CONTENT_PANE_PROPERTY
Bound property name.

 o MENU_BAR_PROPERTY
 public static final String MENU_BAR_PROPERTY
Bound property name.

 o TITLE_PROPERTY
 public static final String TITLE_PROPERTY
Bound property name.

 o LAYERED_PANE_PROPERTY
 public static final String LAYERED_PANE_PROPERTY
Bound property name.

 o ROOT_PANE_PROPERTY
 public static final String ROOT_PANE_PROPERTY
Bound property name.

 o GLASS_PANE_PROPERTY
 public static final String GLASS_PANE_PROPERTY
Bound property name.

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

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

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

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

Constructors

 o JInternalFrame
 public JInternalFrame()
Creates a JInternalFrame with no title, and all boolean setting false.

 o JInternalFrame
 public JInternalFrame(String title)
Creates a JInternalFrame with title, and all boolean setting false.

 o JInternalFrame
 public JInternalFrame(String title,
                       boolean resizable)
 o JInternalFrame
 public JInternalFrame(String title,
                       boolean resizable,
                       boolean closable)
 o JInternalFrame
 public JInternalFrame(String title,
                       boolean resizable,
                       boolean closable,
                       boolean maximizable)
 o JInternalFrame
 public JInternalFrame(String title,
                       boolean resizable,
                       boolean closable,
                       boolean maximizable,
                       boolean iconifiable)
Primitive creation method that sets the appropriate values.

Methods

 o createRootPane
 protected JRootPane createRootPane()
 o getUI
 public InternalFrameUI getUI()
 o setUI
 public void setUI(InternalFrameUI ui)
Sets the UI delegate for this JInternalFrame.

 o updateUI
 public void updateUI()
Resets the UI property to a value from the current look and feel.

Overrides:
updateUI in class JComponent
 o getUIClassID
 public String getUIClassID()
Returns:
"InternalFrameUI"
Overrides:
getUIClassID in class JComponent
See Also:
getUIClassID, getUI
 o isRootPaneCheckingEnabled
 protected boolean isRootPaneCheckingEnabled()
Returns:
true if add and setLayout should be checked
See Also:
addImpl, setLayout, setRootPaneCheckingEnabled
 o setRootPaneCheckingEnabled
 protected void setRootPaneCheckingEnabled(boolean enabled)
If true then calls to add() and setLayout() will cause an exception to be thrown.

See Also:
addImpl, setLayout, isRootPaneCheckingEnabled
 o 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.

Throws: Error
if called with rootPaneChecking true
Overrides:
addImpl in class Container
See Also:
setRootPaneCheckingEnabled
 o 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.

Throws: Error
if called with rootPaneChecking true
Overrides:
setLayout in class Container
See Also:
setRootPaneCheckingEnabled
 o getMenuBar
 public JMenuBar getMenuBar()
Returns the current JMenuBar for this JInternalFrame, or null if no menu bar has been set.

See Also:
setMenuBar
 o setMenuBar
 public void setMenuBar(JMenuBar m)
Sets the JMenuBar for this JInternalFrame.

See Also:
getMenuBar
 o getContentPane
 public Container getContentPane()
See Also:
getContentPane
 o setContentPane
 public void setContentPane(Container c)
Sets this JInternalFrame's content pane.

See Also:
getContentPane
 o getLayeredPane
 public JLayeredPane getLayeredPane()
See Also:
setLayeredPane
 o setLayeredPane
 public void setLayeredPane(JLayeredPane layered)
See Also:
setLayeredPane
 o getGlassPane
 public Component getGlassPane()
See Also:
setGlassPane
 o setGlassPane
 public void setGlassPane(Component glass)
See Also:
getGlassPane
 o getRootPane
 public JRootPane getRootPane()
Overrides:
getRootPane in class JComponent
See Also:
getRootPane
 o setRootPane
 protected void setRootPane(JRootPane root)
Set the rootPane property. This method is called by the constructor.

 o setVisible
 public void setVisible(boolean b)
Set the visible state of the object.

Parameters:
b - if true, shows this object; otherwise, hides it
Overrides:
setVisible in class JComponent
 o setClosable
 public void setClosable(boolean b)
Set that this JInternalFrame can be closed by some user action.

 o isClosable
 public boolean isClosable()
Returns whether this JInternalFrame be closed by some user action.

 o isClosed
 public boolean isClosed()
 o setClosed
 public void setClosed(boolean b) throws PropertyVetoException
Calling this method with true, will cause the frame to close.

Throws: PropertyVetoException
when the attempt to set the property is vetoed by the receiver.
 o setResizable
 public void setResizable(boolean b)
Set that the JInternalFrame resizable by some user action.

 o isResizable
 public boolean isResizable()
 o setIconifiable
 public void setIconifiable(boolean b)
Set that the JInternalFrame can be made an icon by some user action.

 o isIconifiable
 public boolean isIconifiable()
 o isIcon
 public boolean isIcon()
 o setIcon
 public void setIcon(boolean b) throws PropertyVetoException
Setting this property to true will iconify the frame, false will deiconify.

Throws: PropertyVetoException
when the attempt to set the property is vetoed by the receiver.
 o setMaximizable
 public void setMaximizable(boolean b)
Set that the JInternalFrame can be maximized by some user action.

 o isMaximizable
 public boolean isMaximizable()
 o isMaximum
 public boolean isMaximum()
 o setMaximum
 public void setMaximum(boolean b) throws PropertyVetoException
Setting this property to true will maximize the frame, false will minimize.

Throws: PropertyVetoException
when the attempt to set the property is vetoed by the receiver.
 o getTitle
 public String getTitle()
Returns the current JInternalFrame title.

See Also:
setTitle
 o setTitle
 public void setTitle(String title)
Sets the JInternalFrame title.

See Also:
getTitle
 o setSelected
 public void setSelected(boolean selected) throws PropertyVetoException
A JInternalFrame normally draws it's title bar differently if it is the selected frame. This normally indicates that this internalFrame has focus for the user.

Throws: PropertyVetoException
when the attempt to set the property is vetoed by the receiver.
 o isSelected
 public boolean isSelected()
 o setFrameIcon
 public void setFrameIcon(Icon icon)
Sets an image to be displayed in the titlebar of the frame. Do not confuse this with the desktopIcon object, which describes what is displayed in the JDesktop when the frame is iconified.

 o getFrameIcon
 public Icon getFrameIcon()
 o getBackground
 public Color getBackground()
Get the background color of this object.

Returns:
the background color, if supported, of the object; otherwise, null
Overrides:
getBackground in class Component
 o setBackground
 public void setBackground(Color c)
Set the background color of this object. (For transparency, see isOpaque.)

Parameters:
c - the new Color for the background
Overrides:
setBackground in class Component
See Also:
isOpaque
 o getForeground
 public Color getForeground()
Get the foreground color of this object.

Returns:
the foreground color, if supported, of the object; otherwise, null
Overrides:
getForeground in class Component
 o setForeground
 public void setForeground(Color c)
Set the foreground color of this object.

Parameters:
c - the new Color for the foreground
Overrides:
setForeground in class Component
 o moveToFront
 public void moveToFront()
Convenience method that moves this component to position 0 if it's parent is a JLayeredPane.

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

 o setLayer
 public void setLayer(Integer layer)
Convenience method for setting the layer attribute of this component.

 o getLayer
 public int getLayer()
Convenience method for getting the layer attribute of this component.

 o getDesktopPane
 public JDesktopPane getDesktopPane()
Convenience method that searchs the anscestor heirarchy for a JDesktop instance. If JInternalFrame finds none, the desktopIcon tree is searched.

 o setDesktopIcon
 public void setDesktopIcon(JInternalFrame. JDesktopIcon d)
Sets the JDesktopIcon associated with this JInternalFrame.

See Also:
getDesktopIcon
 o getDesktopIcon
 public JInternalFrame. JDesktopIcon getDesktopIcon()
Returns the JDesktopIcon used when this JInternalFrame is iconified.

See Also:
setDesktopIcon
 o 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
 o addInternalFrameListener
 public synchronized 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
 o removeInternalFrameListener
 public synchronized 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
 o processEvent
 protected void processEvent(AWTEvent e)
Processes events on this internal frame. If the event has a InternalFrameEvent id, it notifies its internalFrameListener, else it invokes its superclass's processEvent.

Parameters:
e - the event
Overrides:
processEvent in class Container
 o 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

The value is set to HIDE_ON_CLOSE by default.

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

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

See Also:
pack
 o 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:
show, toFront, setVisible
 o dispose
 public void dispose()
Disposes of this internal frame.

 o toFront
 public void toFront()
Brings this internal frame to the front.

See Also:
toFront, moveToFront
 o 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:
toBack, moveToBack
 o 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:
getWarningString
 o mousePressed
 public void mousePressed(MouseEvent e)
 o mouseEntered
 public void mouseEntered(MouseEvent e)
 o mouseMoved
 public void mouseMoved(MouseEvent e)
 o mouseExited
 public void mouseExited(MouseEvent e)
 o mouseClicked
 public void mouseClicked(MouseEvent e)
 o mouseReleased
 public void mouseReleased(MouseEvent e)
 o mouseDragged
 public void mouseDragged(MouseEvent e)
 o componentResized
 public void componentResized(ComponentEvent e)
Invoked when a maximized JInternalFrame's parent's size changes.

 o componentMoved
 public void componentMoved(ComponentEvent e)
 o componentShown
 public void componentShown(ComponentEvent e)
 o componentHidden
 public void componentHidden(ComponentEvent e)
 o getAccessibleContext
 public AccessibleContext getAccessibleContext()
Get the AccessibleContext associated with this JComponent

Returns:
the AccessibleContext of this JComponent
Overrides:
getAccessibleContext in class JComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index