Spec-Zone .ru
спецификации, руководства, описания, API
|
|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JInternalFrame
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.
JDesktopPane
,
DesktopManager
,
JInternalFrame.JDesktopIcon
,
JRootPane
, Serialized FormInner 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 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.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected JRootPane rootPane
contentPane
and optional menuBar
for this frame, as well as the
glassPane
.JRootPane
,
RootPaneContainer
protected boolean rootPaneCheckingEnabled
add
and setLayout
cause an exception to be thrown.protected boolean closable
protected boolean isClosed
protected boolean maximizable
protected boolean isMaximum
maximizable
protected boolean iconable
JInternalFrame.JDesktopIcon
protected boolean isIcon
iconable
protected boolean resizable
protected boolean isSelected
protected Icon frameIcon
protected String title
protected JInternalFrame.JDesktopIcon desktopIcon
iconable
public static final String CONTENT_PANE_PROPERTY
public static final String MENU_BAR_PROPERTY
public static final String TITLE_PROPERTY
public static final String LAYERED_PANE_PROPERTY
public static final String ROOT_PANE_PROPERTY
public static final String GLASS_PANE_PROPERTY
public static final String FRAME_ICON_PROPERTY
public static final String IS_SELECTED_PROPERTY
public static final String IS_CLOSED_PROPERTY
public static final String IS_MAXIMUM_PROPERTY
public static final String IS_ICON_PROPERTY
Constructor Detail |
public JInternalFrame()
public JInternalFrame(String title)
title
- the String to display in the title bar.public JInternalFrame(String title, boolean resizable)
title
- the String to display in the title bar.resizable
- if true, the frame can be resizedpublic JInternalFrame(String title, boolean resizable, boolean closable)
title
- the String to display in the title bar.resizable
- if true, the frame can be resizedclosable
- if true, the frame can be closedpublic JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable)
title
- the String to display in the title bar.resizable
- if true, the frame can be resizedclosable
- if true, the frame can be closedmaximizable
- if true, the frame can be maximizedpublic JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable)
title
- the String to display in the title bar.resizable
- if true, the frame can be resizedclosable
- if true, the frame can be closedmaximizable
- if true, the frame can be maximizediconifiable
- if true, the frame can be iconifiedMethod Detail |
protected JRootPane createRootPane()
JRootPane
public InternalFrameUI getUI()
public void setUI(InternalFrameUI ui)
public void updateUI()
JComponent.updateUI()
public String getUIClassID()
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
protected boolean isRootPaneCheckingEnabled()
add
and
setLayout
cause an exception to be thrown.add
and setLayout
are checkedaddImpl(java.awt.Component, java.lang.Object, int)
,
setLayout(java.awt.LayoutManager)
,
setRootPaneCheckingEnabled(boolean)
protected void setRootPaneCheckingEnabled(boolean enabled)
add
and
setLayout
cause an exception to be thrown.enabled
- a boolean value, true if checking is to be
enabled, which cause the exceptions to be thrownaddImpl(java.awt.Component, java.lang.Object, int)
,
setLayout(java.awt.LayoutManager)
,
isRootPaneCheckingEnabled()
protected void addImpl(Component comp, Object constraints, int index)
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.
setRootPaneCheckingEnabled(boolean)
public void remove(Component comp)
comp
- the component to be removedContainer.add(java.awt.Component)
public void setLayout(LayoutManager manager)
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.
setRootPaneCheckingEnabled(boolean)
public JMenuBar getMenuBar()
getJMenuBar()
.
public JMenuBar getJMenuBar()
setJMenuBar(javax.swing.JMenuBar)
public void setMenuBar(JMenuBar m)
setJMenuBar(JMenuBar m)
.
m
- the JMenuBar to use in this framegetJMenuBar()
public void setJMenuBar(JMenuBar m)
m
- the JMenuBar to use in this framegetJMenuBar()
public Container getContentPane()
RootPaneContainer.setContentPane(java.awt.Container)
public void setContentPane(Container c)
contentPane
- the contentPane object for this frameRootPaneContainer.getContentPane()
public JLayeredPane getLayeredPane()
RootPaneContainer.setLayeredPane(javax.swing.JLayeredPane)
,
RootPaneContainer.getLayeredPane()
public void setLayeredPane(JLayeredPane layered)
layeredPane
- the layeredPane object for this frameRootPaneContainer.setLayeredPane(javax.swing.JLayeredPane)
public Component getGlassPane()
RootPaneContainer.setGlassPane(java.awt.Component)
public void setGlassPane(Component glass)
glassPane
- the glassPane object for this frameRootPaneContainer.getGlassPane()
public JRootPane getRootPane()
RootPaneContainer.getRootPane()
protected void setRootPane(JRootPane root)
public void setVisible(boolean b)
b
- if true, shows this object; otherwise, hides itpublic void setClosable(boolean b)
b
- a boolean value, where true means the frame can be closedpublic boolean isClosable()
public boolean isClosed()
public void setClosed(boolean b) throws PropertyVetoException
true
to close
the frame.b
- a boolean, where true means "close the frame"public void setResizable(boolean b)
b
- a boolean, where true means the frame can be resizedpublic boolean isResizable()
public void setIconifiable(boolean b)
b
- a boolean, where true means the frame can be iconifiedpublic boolean isIconifiable()
public boolean isIcon()
public void setIcon(boolean b) throws PropertyVetoException
b
- a boolean, where true means to iconify the frame and
false means to deiconify itpublic void setMaximizable(boolean b)
b
- a boolean where true means the frame can be maximizedpublic boolean isMaximizable()
public boolean isMaximum()
public void setMaximum(boolean b) throws PropertyVetoException
b
- a boolean, where true maximizes the frame and false
restores itpublic String getTitle()
setTitle(java.lang.String)
public void setTitle(String title)
title
- the String to display in the title bargetTitle()
public void setSelected(boolean selected) throws PropertyVetoException
selected
- a boolean, where true means the frame is selected
(currently active) and false means it is notpublic boolean isSelected()
setSelected(boolean)
public void setFrameIcon(Icon icon)
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.icon
- the Icon to display in the title bargetFrameIcon()
public Icon getFrameIcon()
setFrameIcon(javax.swing.Icon)
public void moveToFront()
public void moveToBack()
public void setLayer(Integer layer)
layer
- an Integer object specifying this frame's desktop layerJLayeredPane
public int getLayer()
JLayeredPane
public JDesktopPane getDesktopPane()
public void setDesktopIcon(JInternalFrame.JDesktopIcon d)
d
- the JDesktopIcon to display on the desktopgetDesktopIcon()
public JInternalFrame.JDesktopIcon getDesktopIcon()
setDesktopIcon(javax.swing.JInternalFrame.JDesktopIcon)
public void reshape(int x, int y, int width, int height)
x
- an int giving the component's new horizontal position
measured in pixels from the left of its containery
- an int giving the component's new vertical position,
measured in pixels from the bottom of its containerwidth
- an int giving the component's new width in pixelsheight
- an int giving the component's new height in pixelspublic void addInternalFrameListener(InternalFrameListener l)
l
- the internal frame listenerpublic void removeInternalFrameListener(InternalFrameListener l)
l
- the internal frame listenerprotected void fireInternalFrameEvent(int id)
public void setDefaultCloseOperation(int operation)
The value is set to HIDE_ON_CLOSE by default.
addInternalFrameListener(javax.swing.event.InternalFrameListener)
,
getDefaultCloseOperation()
public int getDefaultCloseOperation()
setDefaultCloseOperation(int)
public void pack()
Window.pack()
public void show()
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.
Window.show()
,
Window.toFront()
,
Component.setVisible(boolean)
public void dispose()
public void toFront()
Window.toFront()
,
moveToFront()
public void toBack()
Window.toBack()
,
moveToBack()
public final String getWarningString()
Window.getWarningString()
protected String paramString()
null
.protected void paintComponent(Graphics g)
JComponent.paint(java.awt.Graphics)
public AccessibleContext getAccessibleContext()
|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |