所有类


javax.swing
类 JSplitPane

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

public class JSplitPane
   
   
   
   
extends JComponent
implements Accessible

JSplitPane 用于分隔两个(只能两个)Component。两个 Component 图形化分隔以外观实现为基础,并且这两个 Component 可以由用户交互式调整大小。有关如何使用 JSplitPane 的信息,请参阅《The Java Tutorial》中的 How to Use Split Panes 一节。

使用 JSplitPane.HORIZONTAL_SPLIT 可让分隔窗格中的两个 Component 从左到右排列,或者使用 JSplitPane.VERTICAL_SPLIT 使其从上到下排列。改变 Component 大小的首选方式是调用 setDividerLocation,其中 location 是新的 x 或 y 位置,具体取决于 JSplitPane 的方向。

要将 Component 调整到其首选大小,可调用 resetToPreferredSizes

当用户调整 Components 的大小时,Components 的最小大小用于确定 Component 能够设置的最大/最小位置。如果两个组件的最小大小大于分隔窗格的大小,则分隔条将不允许您调整其大小。改变 JComponent 最小大小,请参阅 JComponent.setMinimumSize(java.awt.Dimension)

当用户调整分隔窗格大小时,新的空间以 resizeWeight 为基础在两个组件之间分配。默认情况下,值为 0 表示右边/底部的组件获得所有空间,而值为 1 表示左边/顶部的组件获得所有空间。

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

另请参见:
setDividerLocation(double), resetToPreferredSizes()

嵌套类摘要
protected  classJSplitPane.AccessibleJSplitPane
          此类实现 JSplitPane 类的可访问性支持。
 
从类 javax.swing.JComponent 继承的嵌套类/接口
JComponent.AccessibleJComponent
 
从类 java.awt.Container 继承的嵌套类/接口
Container.AccessibleAWTContainer
 
从类 java.awt.Component 继承的嵌套类/接口
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
字段摘要
static StringBOTTOM
          用于添加一个 Component 到另一个 Component 的下面。
static StringCONTINUOUS_LAYOUT_PROPERTY
          绑定 continuousLayout 属性名称。
protected  booleancontinuousLayout
          当调整大小时视图是否连续重新显示。
static StringDIVIDER
          用于添加一个表示分隔条的 Component
static StringDIVIDER_LOCATION_PROPERTY
          绑定 dividerLocation 属性。
static StringDIVIDER_SIZE_PROPERTY
          绑定 border 属性名称。
protected  intdividerSize
          分隔条大小。
static intHORIZONTAL_SPLIT
          水平分割表示 Component 沿 x 轴分割。
static StringLAST_DIVIDER_LOCATION_PROPERTY
          绑定 lastLocation 属性。
protected  intlastDividerLocation
          分隔窗格的上一个位置。
static StringLEFT
          用于添加一个 Component 到另一个 Component 的左边。
protected  ComponentleftComponent
          左边或者顶部的组件。
static StringONE_TOUCH_EXPANDABLE_PROPERTY
          绑定 oneTouchExpandable 属性。
protected  booleanoneTouchExpandable
          是否要提供一个小部件来快速展开/折叠分隔窗格。
protected  intorientation
          如何分割视图。
static StringORIENTATION_PROPERTY
          绑定 orientation(水平或者垂直)属性名称。
static StringRESIZE_WEIGHT_PROPERTY
          绑定 weight 属性。
static StringRIGHT
          用于添加一个 Component 到另一个 Component 的右边。
protected  ComponentrightComponent
          右边或者底部的组件。
static StringTOP
          用于添加一个 Component 到另一个 Component 的上面。
static intVERTICAL_SPLIT
          垂直分割表示 Component 沿 y 轴分割。
 
从类 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
 
从接口 java.awt.image.ImageObserver 继承的字段
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
构造方法摘要
JSplitPane()
          创建一个配置为将其子组件水平排列、无连续布局、为组件使用两个按钮的新 JSplitPane
JSplitPane(int newOrientation)
          创建一个配置为指定方向且无连续布局的新 JSplitPane
JSplitPane(int newOrientation, boolean newContinuousLayout)
          创建一个具有指定方向和重绘方式的新 JSplitPane
JSplitPane(int newOrientation, boolean newContinuousLayout, Component newLeftComponent, Component newRightComponent)
          创建一个具有指定方向、重绘方式和指定组件的新 JSplitPane
JSplitPane(int newOrientation, Component newLeftComponent, Component newRightComponent)
          创建一个具有指定方向和不连续重绘的指定组件的新 JSplitPane
 
方法摘要
protected  voidaddImpl(Component comp, Object constraints, int index)
          将指定组件添加到此分隔窗格。
 AccessibleContextgetAccessibleContext()
          获取与 JSplitPane 关联的 AccessibleContext。
 ComponentgetBottomComponent()
          返回分隔条下面或者右边的组件。
 intgetDividerLocation()
          返回最后传递给 setDividerLocation 的值。
 intgetDividerSize()
          返回分隔条的大小。
 intgetLastDividerLocation()
          返回分隔条所处的最后位置。
 ComponentgetLeftComponent()
          返回分隔条左边(或者上面)的组件。
 intgetMaximumDividerLocation()
          返回外观实现中分隔条的最大位置。
 intgetMinimumDividerLocation()
          返回外观实现中分隔条的最小位置。
 intgetOrientation()
          返回方向。
 doublegetResizeWeight()
          返回确定额外空间如何分配的数。
 ComponentgetRightComponent()
          返回分隔条右边(或者下面)的组件。
 ComponentgetTopComponent()
          返回分隔条上面或者左边的组件。
 SplitPaneUIgetUI()
          返回提供当前外观的 SplitPaneUI
 StringgetUIClassID()
          返回呈现此组件的 L&F 类名。
 booleanisContinuousLayout()
          获取 continuousLayout 属性。
 booleanisOneTouchExpandable()
          获取 oneTouchExpandable 属性。
 booleanisValidateRoot()
          如果返回 true,则在此 JSplitPane 的任何后代上调用 revalidate,将导致在队列中加入一个验证 JSplitPane 及其所有后代的一个请求。
protected  voidpaintChildren(Graphics g)
          通知超类后,UI 通过 finishedPaintingChildren 通知子类,同时绘制边框。
protected  StringparamString()
          返回此 JSplitPane 的字符串表示形式。
 voidremove(Component component)
          移除窗格中的子组件 component
 voidremove(int index)
          移除指定索引处的 Component
 voidremoveAll()
          从分隔窗格中移除所有子组件。
 voidresetToPreferredSizes()
          以子组件的首选大小为基础调整 JSplitPane 的布局。
 voidsetBottomComponent(Component comp)
          将组件设置到分隔条的下面或者右边。
 voidsetContinuousLayout(boolean newContinuousLayout)
          设置 continuousLayout 属性的值,在用户干预期要使子组件连续地重新显示和布局子组件,此值必须为 true
 voidsetDividerLocation(double proportionalLocation)
          设置分隔条的位置为 JSplitPane 大小的一个百分比。
 voidsetDividerLocation(int location)
          设置分隔条的位置。
 voidsetDividerSize(int newSize)
          设置分隔条的大小。
 voidsetLastDividerLocation(int newLastLocation)
          将分隔条所处的最后位置设置为 newLastLocation
 voidsetLeftComponent(Component comp)
          将组件设置到分隔条的左边(或上面)。
 voidsetOneTouchExpandable(boolean newValue)
          设置 oneTouchExpandable 属性的值,要使 JSplitPane 在分隔条上提供一个 UI 小部件来快速展开/折叠分隔条,此属性必须为 true
 voidsetOrientation(int orientation)
          设置方向,或者分隔窗格的方式。
 voidsetResizeWeight(double value)
          指定当分隔窗格的大小改变时如何分配额外空间。
 voidsetRightComponent(Component comp)
          将组件设置到分隔条的右边(或者下面)。
 voidsetTopComponent(Component comp)
          将组件设置到分隔条的上面或者左边。
 voidsetUI(SplitPaneUI ui)
          设置呈现此组件的 L&F 对象。
 voidupdateUI()
          UIManager 发出的关于 L&F 已改变的通知。
 
从类 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, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintComponent, 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, reshape, 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, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, getFocusCycleRootAncestor, 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, hide, 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, show, size, toString, transferFocus, transferFocusUpCycle
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

VERTICAL_SPLIT

public static final int VERTICAL_SPLIT
垂直分割表示 Component 沿 y 轴分割。例如,两个 Component 将被分割成一个在另一个顶上。

另请参见:
常量字段值

HORIZONTAL_SPLIT

public static final int HORIZONTAL_SPLIT
水平分割表示 Component 沿 x 轴分割。例如,两个 Component 将被分割成一个在另一个左边。

另请参见:
常量字段值

LEFT

public static final String LEFT
用于添加一个 Component 到另一个 Component 的左边。

另请参见:
常量字段值

RIGHT

public static final String RIGHT
用于添加一个 Component 到另一个 Component 的右边。

另请参见:
常量字段值

TOP

public static final String TOP
用于添加一个 Component 到另一个 Component 的上面。

另请参见:
常量字段值

BOTTOM

public static final String BOTTOM
用于添加一个 Component 到另一个 Component 的下面。

另请参见:
常量字段值

DIVIDER

public static final String DIVIDER
用于添加一个表示分隔条的 Component

另请参见:
常量字段值