所有类


javax.swing
类 JInternalFrame

java.lang.Object
  继承者 java.awt.Component
      继承者 java.awt.Container
          继承者 javax.swing.JComponent
              继承者 javax.swing.JInternalFrame
所有已实现的接口:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class JInternalFrame
   
   
   
   
   
extends JComponent
implements Accessible, WindowConstants, RootPaneContainer

提供很多本机窗体功能的轻量级对象,这些功能包括拖动、关闭、变成图标、调整大小、标题显示和支持菜单栏。有关使用内部窗体的面向任务的文档和示例,请参见《The Java Tutorial》中的 How to Use Internal Frames 一节。

通常,可将 JInternalFrame 添加到 JDesktopPane 中。UI 将特定于外观的操作委托给由 JDesktopPane 维护的 DesktopManager 对象。

JInternalFrame 内容窗格是添加子组件的地方。作为 add 的便捷方法及其变体,已经重写了 removesetLayout,以在必要时将其转发到 contentPane。这意味着可以编写:

       internalFrame.add(child);
 
子级将被添加到 contentPane。内容窗格实际上由 JRootPane 的实例管理,它还管理 layoutPane、glassPane 和内部窗体的可选菜单栏。有关这些组件的完整描述,请参见 JRootPane 文档。有关添加、移除和设置 JInternalFrameLayoutManager 的详情,请参阅 RootPaneContainer

警告:此类的已序列化对象与以后的 Swing 版本不兼容。当前序列化支持适用于短期存储,或适用于在运行相同 Swing 版本的应用程序之间进行 RMI(Remote Method Invocation,远程方法调用)。从 1.4 版本开始,已在 java.beans 包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder

另请参见:
InternalFrameEvent, JDesktopPane, DesktopManager, JInternalFrame.JDesktopIcon, JRootPane, RootPaneContainer

嵌套类摘要
protected  classJInternalFrame.AccessibleJInternalFrame
          此类实现对 JInternalFrame 类的可访问性支持。
static classJInternalFrame.JDesktopIcon
          此组件表示 JInternalFrame 的图标化版本。
 
从类 javax.swing.JComponent 继承的嵌套类/接口
JComponent.AccessibleJComponent
 
从类 java.awt.Container 继承的嵌套类/接口
Container.AccessibleAWTContainer
 
从类 java.awt.Component 继承的嵌套类/接口
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
字段摘要
protected  booleanclosable
          可以关闭的窗体。
static StringCONTENT_PANE_PROPERTY
          Bound 属性名。
protected  JInternalFrame.JDesktopIcondesktopIcon
          此内部窗体图标化时所显示的图标。
static StringFRAME_ICON_PROPERTY
          Bound 属性名。
protected  IconframeIcon
          此内部窗体左上角显示的图标。
static StringGLASS_PANE_PROPERTY
          Bound 属性名。
protected  booleaniconable
          可以“图标化”frame(缩小并显示为图标图像)。
static StringIS_CLOSED_PROPERTY
          Constrained 属性名,指示该内部窗体已关闭。
static StringIS_ICON_PROPERTY
          Constrained 属性名,指示该内部窗体已图标化。
static StringIS_MAXIMUM_PROPERTY
          Constrained 属性名,指示该内部窗体已最大化。
static StringIS_SELECTED_PROPERTY
          Constrained 属性名,指示此窗体具有选定状态。
protected  booleanisClosed
          已经关闭的窗体。
protected  booleanisIcon
          frame 已图标化。
protected  booleanisMaximum
          已将窗体扩展到其最大大小。
protected  booleanisSelected
          当前已选中窗体。
static StringLAYERED_PANE_PROPERTY
          Bound 属性名。
protected  booleanmaximizable
          可将窗体扩展到桌面窗格的大小。
static StringMENU_BAR_PROPERTY
          Bound 属性名。
protected  booleanresizable
          可以更改窗体的大小。
static StringROOT_PANE_PROPERTY
          Bound 属性名。
protected  JRootPanerootPane
          JRootPane 实例管理此内部窗体的 contentPane 和可选的 menuBar,以及 glassPane。
protected  booleanrootPaneCheckingEnabled
          如果为 true,则将对 addsetLayout 的调用转发到 contentPane
protected  Stringtitle
          此内部窗体标题栏中所显示的标题。
static StringTITLE_PROPERTY
          Bound 属性名。
 
从类 javax.swing.JComponent 继承的字段
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
从类 java.awt.Component 继承的字段
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
从接口 javax.swing.WindowConstants 继承的字段
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
从接口 java.awt.image.ImageObserver 继承的字段
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
构造方法摘要
JInternalFrame()
          创建不可调整大小的、不可关闭的、不可最大化的、不可图标化的、没有标题的 JInternalFrame
JInternalFrame(String title)
          创建不可调整大小的、不可关闭的、不可最大化的、不可图标化的、具有指定标题的 JInternalFrame
JInternalFrame(String title, boolean resizable)
          创建不可关闭的、不可最大化的、不可图标化的,以及具有指定标题和可调整大小的 JInternalFrame
JInternalFrame(String title, boolean resizable, boolean closable)
          创建不可最大化的、不可图标化的,以及具有指定标题、可调整大小和可关闭的 JInternalFrame
JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable)
          创建不可图标化的,但具有指定标题、可调整大小、可关闭和可最大化的 JInternalFrame
JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable)
          创建具有指定标题、可调整、可关闭、可最大化和可图标化的 JInternalFrame
 
方法摘要
protected  voidaddImpl(Component comp, Object constraints, int index)
          添加指定的子 Component
 voidaddInternalFrameListener(InternalFrameListener l)
          添加指定的侦听器,以从此内部窗体接收内部窗体事件。
protected  JRootPanecreateRootPane()
          构造方法调用此方法来设置 JRootPane
 voiddispose()
          使此内部窗体不可见、取消选定并关闭它。
 voiddoDefaultCloseAction()
          激发 INTERNAL_FRAME_CLOSING 事件,然后执行内部窗体的默认 close 操作所指定的操作。
protected  voidfireInternalFrameEvent(int id)
          激发内部窗体事件。
 AccessibleContextgetAccessibleContext()
          获得与此 JInternalFrame 关联的 AccessibleContext
 ContainergetContentPane()
          返回此内部窗体的内容窗格。
 intgetDefaultCloseOperation()
          返回用户在此内部窗体上发起 "close" 时默认执行的操作。
 JInternalFrame.JDesktopIcongetDesktopIcon()
          返回图标化此 JInternalFrame 时使用的 JDesktopIcon
 JDesktopPanegetDesktopPane()
          在祖先层次结构中搜索 JDesktop 实例的便捷方法。
 ContainergetFocusCycleRootAncestor()
          始终返回 null,原因是 JInternalFrame 必须始终为焦点遍历循环的根。
 ComponentgetFocusOwner()
          如果此 JInternalFrame 处于激活状态,则返回具有焦点的子组件。
 IcongetFrameIcon()
          返回要在此内部窗体的标题栏中显示的图像(通常显示在左上角)。
 ComponentgetGlassPane()
          返回此内部窗体的 glassPane。
 InternalFrameListener[]getInternalFrameListeners()
          返回使用 addInternalFrameListener 添加到此 JInternalFrame 的所有 InternalFrameListener 的数组。
 JMenuBargetJMenuBar()
          返回此 JInternalFrame 的当前 JMenuBar;如果尚未设置菜单栏,则返回 null
 intgetLayer()
          获得此组件 layer 属性的便捷方法。
 JLayeredPanegetLayeredPane()
          返回此内部窗体的 layeredPane。
 JMenuBargetMenuBar()
          已过时。 从 Swing version 1.0.3 开始,由 getJMenuBar() 取代。
 ComponentgetMostRecentFocusOwner()
          返回选定此 JInternalFrame 时,将接收焦点的 JInternalFrame 子组件。
 RectanglegetNormalBounds()
          如果 JInternalFrame 未处于最大化状态,则返回 getBounds();否则返回还原 JInternalFrame 后的边界。
 JRootPanegetRootPane()
          返回此内部窗体的 rootPane 对象。
 StringgetTitle()
          返回 JInternalFrame 的标题。
 InternalFrameUIgetUI()
          返回呈现此组件的外观对象。
 StringgetUIClassID()
          返回呈现此组件的外观类名。
 StringgetWarningString()
          获取此内部窗体中显示的警告字符串。
 voidhide()
           
 booleanisClosable()
          返回是否可以通过某个用户操作关闭此 JInternalFrame
 booleanisClosed()
          返回此 JInternalFrame 当前是否已关闭。
 booleanisFocusCycleRoot()
          始终返回 true,原因是所有 JInternalFrame 必须为焦点遍历循环的根。
 booleanisIcon()
          返回 JInternalFrame 当前是否已图标化。
 booleanisIconifiable()
          获取该 iconable 属性(默认情况下为 false)。
 booleanisMaximizable()
          获取该 maximizable 属性的值。
 booleanisMaximum()
          返回 JInternalFrame 当前是否已最大化。
 booleanisResizable()
          返回是否可以通过某个用户操作调整 JInternalFrame 的大小。
protected  booleanisRootPaneCheckingEnabled()
          返回是否将对 addsetLayout 的调用转发到 contentPane
 booleanisSelected()
          返回 JInternalFrame 当前是否为“选定的”或处于激活状态的窗体。
 voidmoveToBack()
          如果此组件的父组件是 JLayeredPane,则将此组件移至位置 -1 的便捷方法。
 voidmoveToFront()
          如果此组件的父组件是 JLayeredPane,则将此组件移至位置 0 的便捷方法。
 voidpack()
          使此 JInternalFrame 的子组件按其首选大小进行布局。
protected  voidpaintComponent(Graphics g)
          重写此方法,以便在拖动内部窗体时允许进行优化的绘制。
protected  StringparamString()
          返回此 JInternalFrame 的字符串表示形式。
 voidremove(Component comp)
          从此容器中移除指定组件。
 voidremoveInternalFrameListener(InternalFrameListener l)
          移除指定的内部窗体侦听器,不再接收此内部窗体发出的内部窗体事件。
 voidreshape(int x, int y, int width, int height)
          移动此组件并调整其大小。
 voidrestoreSubcomponentFocus()
          请求内部窗体将焦点还原到具有焦点的最后一个子组件。
 voidsetClosable(boolean b)
          设置是否可以通过某个用户操作关闭此 JInternalFrame
 voidsetClosed(boolean b)
          如果参数为 true,则关闭此内部窗体。
 voidsetContentPane(Container c)
          设置此 JInternalFramecontentPane 属性。
 voidsetDefaultCloseOperation(int operation)
          设置用户在此内部窗体上发起 "close" 时默认执行的操作。
 voidsetDesktopIcon(JInternalFrame.JDesktopIcon d)
          设置与此 JInternalFrame 关联的 JDesktopIcon
 voidsetFocusCycleRoot(boolean focusCycleRoot)
          不执行任何操作,原因是 JInternalFrame 必须始终为焦点遍历循环的根。
 voidsetFrameIcon(Icon icon)
          设置要在此内部窗体的标题栏中显示的图像(通常显示在左上角)。
 voidsetGlassPane(Component glass)
          设置此 JInternalFrameglassPane 属性。
 voidsetIcon(boolean b)
          如果外观支持图标化,则对此内部窗体执行图标化或取消图标化。
 voidsetIconifiable(boolean b)
          设置 iconable 属性,对于能够使 JInternalFrame 变成一个图标的用户而言,该属性必须为 true
 voidsetJMenuBar(JMenuBar m)
          设置此 JInternalFramemenuBar 属性。
 voidsetLayer(int layer)
          设置此组件 layer 属性的便捷方法。
 voidsetLayer(Integer layer)
          设置此组件 layer 属性的便捷方法。
 voidsetLayeredPane(JLayeredPane layered)
          设置此 JInternalFramelayeredPane 属性。
 voidsetLayout(LayoutManager manager)
          确保默认情况下无法设置此组件的布局。
 voidsetMaximizable(boolean b)
          设置 maximizable 属性,该属性确定是否可以通过某个用户操作最大化此 JInternalFrame
 voidsetMaximum(boolean b)
          最大化并还原此内部窗体。
 voidsetMenuBar(JMenuBar m)
          已过时。 从 Swing version 1.0.3 开始,由 setJMenuBar(JMenuBar m) 取代。
 voidsetNormalBounds(Rectangle r)
          设置此内部窗体的正常边界,即此内部窗体从其最大化状态还原后的边界。
 voidsetResizable(boolean b)
          设置是否可以通过某个用户操作调整 JInternalFrame 的大小。
protected  voidsetRootPane(JRootPane root)
          设置此 JInternalFramerootPane 属性。
protected  voidsetRootPaneCheckingEnabled(boolean enabled)
          设置是否将对 addsetLayout 的调用转发到 contentPane
 voidsetSelected(boolean selected)
          如果要显示内部窗体,则选定或取消选定该窗体。
 voidsetTitle(String title)
          设置 JInternalFrame 的标题。
 voidsetUI(InternalFrameUI ui)
          设置此 JInternalFrame 的 UI 委托。
 voidshow()
          如果内部窗体不可见,则将该内部窗体置于前端,使其可见并尝试选定它。
 voidtoBack()
          将此内部窗体发送至后台。
 voidtoFront()
          将此内部窗体置于前端。
 voidupdateUI()
          来自 UIManager 的通知,告知外观已更改。
 
从类 javax.swing.JComponent 继承的方法
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
从类 java.awt.Container 继承的方法
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
从类 java.awt.Component 继承的方法
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, size, toString, transferFocus, transferFocusUpCycle
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

rootPane

protected JRootPane rootPane
JRootPane 实例管理此内部窗体的 contentPane 和可选的 menuBar,以及 glassPane。

另请参见:
JRootPane, RootPaneContainer

rootPaneCheckingEnabled

protected boolean rootPaneCheckingEnabled
如果为 true,则将对 addsetLayout 的调用转发到 contentPane。初始设置为 false,但在构造 JInternalFrame 时将其设置为 true。

另请参见:
isRootPaneCheckingEnabled(), setRootPaneCheckingEnabled(boolean), RootPaneContainer

closable

protected boolean closable
可以关闭的窗体。


isClosed

protected boolean isClosed
已经关闭的窗体。


maximizable

protected boolean maximizable
可将窗体扩展到桌面窗格的大小。


isMaximum

protected boolean isMaximum
已将窗体扩展到其最大大小。

另请参见:
maximizable

iconable

protected boolean iconable
可以“图标化”frame(缩小并显示为图标图像)。

另请参见:
JInternalFrame.JDesktopIcon, setIconifiable(boolean)