java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JSplitPane
- 所有已实现的接口:
-
ImageObserver,MenuContainer,Serializable,Accessible
JSplitPane 用于分隔两个(仅限两个)Component。这两个Component在外观实现的基础上被图形化分隔,然后用户可以交互地调整这两个Component的大小。有关如何使用JSplitPane的信息,请参阅The Java Tutorial中的How to Use Split Panes。
拆分窗格中的两个Component可以使用JSplitPane.HORIZONTAL_SPLIT左右对齐,或使用JSplitPane.VERTICAL_SPLIT上下对齐。更改Component的大小的首选方法是调用setDividerLocation,其中location是新的x或y位置,取决于JSplitPane的方向。
要将Component的大小调整为其首选大小,请调用resetToPreferredSizes。
当用户调整Component的大小时,将使用Components的最小大小来确定Component可以设置到的最大/最小位置。如果两个组件的最小大小大于拆分窗格的大小,则分隔符将不允许您调整大小。要更改JComponent的最小大小,请参见JComponent.setMinimumSize(java.awt.Dimension)。
当用户调整拆分窗格时,新空间根据resizeWeight属性在两个组件之间分配。值为0(默认值)表示右/底部组件获得所有空间,而值为1表示左/顶部组件获得所有空间。
警告: Swing 不是线程安全的。有关更多信息,请参阅Swing的线程策略。
警告: 该类的序列化对象将不兼容未来的Swing版本。当前的序列化支持适用于短期存储或在运行相同版本Swing的应用程序之间的RMI。从1.4开始,已将所有JavaBeans的长期存储支持添加到java.beans包中。请参见XMLEncoder。
- 自 JDK 版本:
- 1.2
- 参见:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class该类实现了JSplitPane类的辅助功能支持。Nested classes/interfaces declared in class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces declared in class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces declared in class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String用于在另一个Component下方添加一个Component。static final String连续布局的绑定属性名称。protected boolean在调整大小时是否连续重新显示视图。static final String用于添加一个将表示分隔符的Component。static final String分隔符位置的绑定属性。static final String边框的绑定属性名称。protected int分隔符的大小。static final int水平拆分表示Component沿x轴拆分。static final String上次拆分窗格的位置的绑定属性。protected int拆分窗格的上一个位置。static final String用于在另一个Component左侧添加一个Component。protected Component左侧或顶部的组件。static final StringoneTouchExpandable的绑定属性。protected boolean是否提供一个小部件以快速展开/折叠拆分窗格?protected int视图如何拆分。static final String方向(水平或垂直)的绑定属性名称。static final String权重的绑定属性。static final String用于在另一个Component右侧添加一个Component。protected Component右侧或底部的组件。static final String用于在另一个Component上方添加一个Component。static final int垂直拆分表示Component沿y轴拆分。Fields declared in class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields declared in class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields declared in interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescription创建一个新的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。 -
Method Summary
Modifier and TypeMethodDescriptionprotected void将指定的组件添加到此拆分窗格。获取与此JSplitPane关联的AccessibleContext。返回分隔符下方或右侧的组件。int返回传递给setDividerLocation的最后一个值。int返回分隔符的大小。int返回分隔符上次所在的位置。返回分隔符左侧(或上方)的组件。int返回从外观实现中分隔符的最大位置。int返回从外观实现中分隔符的最小位置。int返回方向。double返回确定额外空间如何分配的数字。返回分隔符右侧(或下方)的组件。返回分隔符上方或左侧的组件。getUI()返回提供当前外观和感觉的SplitPaneUI。返回呈现此组件的L&F类的名称。boolean获取continuousLayout属性。boolean获取oneTouchExpandable属性。boolean返回true,因此对此JSplitPane的任何后代调用revalidate将导致排队请求,该请求将验证JSplitPane及其所有后代。protected void在调用super后,通过消息传递UI的finishedPaintingChildren来子类化,以及绘制边框。protected String返回此JSplitPane的字符串表示形式。voidremove(int index) 删除指定索引处的Component。void从窗格中删除子组件component。void从拆分窗格中删除所有子组件。void根据子组件的首选大小布局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属性的值,该值必须为true,以便JSplitPane提供一个UI小部件,用于快速展开/折叠分隔符。voidsetOrientation(int orientation) 设置方向,或拆分器如何分割。voidsetResizeWeight(double value) 指定当拆分窗格的大小更改时如何分配额外空间。voidsetRightComponent(Component comp) 设置分隔符右侧(或下方)的组件。voidsetTopComponent(Component comp) 设置分隔符上方或左侧的组件。voidsetUI(SplitPaneUI ui) 设置呈现此组件的L&F对象。voidupdateUI()来自UIManager的通知,L&F已更改。Methods declared in class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, updateMethods declared in class 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, transferFocusDownCycle, validate, validateTreeMethods declared in class 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, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
VERTICAL_SPLIT
public static final int VERTICAL_SPLIT垂直拆分表示Component沿y轴拆分。例如,两个Component将垂直拆分。- 参见:
-
HORIZONTAL_SPLIT
public static final int HORIZONTAL_SPLIT水平拆分表示Component沿x轴拆分。例如,两个Component将水平拆分。- 参见:
-
LEFT
用于在另一个Component左侧添加一个Component。- 参见:
-
RIGHT
用于在另一个Component右侧添加一个Component。- 参见:
-
TOP
用于在另一个Component上方添加一个Component。- 参见:
-
BOTTOM
用于在另一个Component下方添加一个Component。- 参见:
-
DIVIDER
用于添加表示分隔线的Component。- 参见:
-
ORIENTATION_PROPERTY
方向(水平或垂直)的绑定属性名称。- 参见:
-
CONTINUOUS_LAYOUT_PROPERTY
连续布局的绑定属性名称。- 参见:
-
DIVIDER_SIZE_PROPERTY
边框的绑定属性名称。- 参见:
-
ONE_TOUCH_EXPANDABLE_PROPERTY
oneTouchExpandable的绑定属性。- 参见:
-
LAST_DIVIDER_LOCATION_PROPERTY
lastLocation的绑定属性。- 参见:
-
DIVIDER_LOCATION_PROPERTY
dividerLocation的绑定属性。- 自JDK版本:
- 1.3
- 参见:
-
RESIZE_WEIGHT_PROPERTY
weight的绑定属性。- 自JDK版本:
- 1.3
- 参见:
-
orientation
protected int orientation视图如何分割。 -
continuousLayout
protected boolean continuousLayout调整大小时是否连续重新显示视图。 -
leftComponent
左侧或顶部组件。 -
rightComponent
右侧或底部组件。 -
dividerSize
protected int dividerSize分隔线的大小。 -
oneTouchExpandable
protected boolean oneTouchExpandable是否提供一个小部件以快速展开/折叠分隔窗格? -
lastDividerLocation
protected int lastDividerLocation分隔窗格的先前位置。
-
-
Constructor Details
-
JSplitPane
public JSplitPane()创建一个新的JSplitPane,配置为水平并排排列子组件,使用两个按钮用于组件。 -
JSplitPane
创建一个具有指定方向的新的JSplitPane。- 参数:
-
newOrientation-JSplitPane.HORIZONTAL_SPLIT或JSplitPane.VERTICAL_SPLIT - 抛出:
-
IllegalArgumentException- 如果orientation不是HORIZONTAL_SPLIT或VERTICAL_SPLIT之一。
-
JSplitPane
public JSplitPane(int newOrientation, boolean newContinuousLayout) 创建一个具有指定方向和重绘样式的新的JSplitPane。- 参数:
-
newOrientation-JSplitPane.HORIZONTAL_SPLIT或JSplitPane.VERTICAL_SPLIT -
newContinuousLayout- 一个布尔值,为true表示组件在分隔线位置改变时连续重绘,为false表示等到分隔线位置停止改变再重绘 - 抛出:
-
IllegalArgumentException- 如果orientation不是HORIZONTAL_SPLIT或VERTICAL_SPLIT之一
-
JSplitPane
创建一个具有指定方向和指定组件的新的JSplitPane。- 参数:
-
newOrientation-JSplitPane.HORIZONTAL_SPLIT或JSplitPane.VERTICAL_SPLIT -
newLeftComponent- 将出现在水平分割窗格左侧或垂直分割窗格顶部的Component -
newRightComponent- 将出现在水平分割窗格右侧或垂直分割窗格底部的Component - 抛出:
-
IllegalArgumentException- 如果orientation不是HORIZONTAL_SPLIT或VERTICAL_SPLIT之一
-
JSplitPane
public JSplitPane(int newOrientation, boolean newContinuousLayout, Component newLeftComponent, Component newRightComponent) 创建一个具有指定方向、重绘样式和指定组件的新的JSplitPane。- 参数:
-
newOrientation-JSplitPane.HORIZONTAL_SPLIT或JSplitPane.VERTICAL_SPLIT -
newContinuousLayout- 一个布尔值,为true表示组件在分隔线位置改变时连续重绘,为false表示等到分隔线位置停止改变再重绘 -
newLeftComponent- 将出现在水平分割窗格左侧或垂直分割窗格顶部的Component -
newRightComponent- 将出现在水平分割窗格右侧或垂直分割窗格底部的Component - 抛出:
-
IllegalArgumentException- 如果orientation不是HORIZONTAL_SPLIT或VERTICAL_SPLIT之一
-
-
Method Details
-
setUI
设置渲染此组件的L&F对象。- 参数:
-
ui-SplitPaneUIL&F对象 - 参见:
-
getUI
@BeanProperty(bound=false, expert=true, description="The L&F object that renders this component.") public SplitPaneUI getUI()返回提供当前外观和感觉的SplitPaneUI。- 覆盖:
-
getUI在类JComponent中 - 返回:
-
渲染此组件的
SplitPaneUI对象
-
updateUI
public void updateUI()来自UIManager的通知,L&F已更改。使用来自UIManager的最新版本替换当前UI对象。- 覆盖:
-
updateUI在类JComponent中 - 参见:
-
getUIClassID
@BeanProperty(bound=false, expert=true, description="A string that specifies the name of the L&F class.") public String getUIClassID()返回渲染此组件的L&F类的名称。- 覆盖:
-
getUIClassID在类JComponent中 - 返回:
- 字符串"SplitPaneUI"
- 参见:
-
setDividerSize
设置分隔线的大小。忽略分隔线大小newSize < 0。- 参数:
-
newSize- 以像素为单位给出分隔线的大小的整数
-
getDividerSize
public int getDividerSize()返回分隔线的大小。- 返回:
- 以像素为单位给出分隔线的大小的整数
-
setLeftComponent
设置分隔线左侧(或上方)的组件。- 参数:
-
comp- 要显示在该位置的Component
-
getLeftComponent
@BeanProperty(bound=false, preferred=true, description="The component to the left (or above) the divider.") public Component getLeftComponent()返回分隔线左侧(或上方)的组件。- 返回:
-
在该位置显示的
Component
-
setTopComponent
@BeanProperty(bound=false, description="The component above, or to the left of the divider.") public void setTopComponent(Component comp) 设置分隔线上方或左侧的组件。- 参数:
-
comp- 要显示在该位置的Component
-
getTopComponent
返回分隔线上方或左侧的组件。- 返回:
-
在该位置显示的
Component
-
setRightComponent
@BeanProperty(bound=false, preferred=true, description="The component to the right (or below) the divider.") public void setRightComponent(Component comp) 设置分隔线右侧(或下方)的组件。- 参数:
-
comp- 要显示在该位置的Component
-
getRightComponent
返回分隔线右侧(或下方)的组件。- 返回:
-
在该位置显示的
Component
-
setBottomComponent
@BeanProperty(bound=false, description="The component below, or to the right of the divider.") public void setBottomComponent(Component comp) 设置分隔线下方或右侧的组件。- 参数:
-
comp- 要显示在该位置的Component
-
getBottomComponent
返回分隔线下方或右侧的组件。- 返回:
-
在该位置显示的
Component
-
setOneTouchExpandable
@BeanProperty(description="UI widget on the divider to quickly expand/collapse the divider.") public void setOneTouchExpandable(boolean newValue) 设置oneTouchExpandable属性的值,必须为true才能使JSplitPane提供一个UI小部件在分隔线上快速展开/折叠分隔线。此属性的默认值为false。某些外观和感觉可能不支持一键展开;它们将忽略此属性。- 参数:
-
newValue-true表示分隔窗格应提供折叠/展开小部件 - 参见:
-
isOneTouchExpandable
public boolean isOneTouchExpandable()获取oneTouchExpandable属性。- 返回:
-
oneTouchExpandable属性的值 - 参见:
-
setLastDividerLocation
@BeanProperty(description="The last location the divider was at.") public void setLastDividerLocation(int newLastLocation) 设置分隔条最后位置为newLastLocation。- 参数:
-
newLastLocation- 一个整数,指定分隔条位置在像素中的最后位置,从面板的左侧(或上侧)到分隔条的左侧(或上侧)
-
getLastDividerLocation
public int getLastDividerLocation()返回分隔条最后位置。- 返回:
- 一个整数,指定分隔条位置作为像素计数,从面板的左侧(或上侧)到分隔条的左侧(或上侧)
-
setOrientation
@BeanProperty(enumerationValues={"JSplitPane.HORIZONTAL_SPLIT","JSplitPane.VERTICAL_SPLIT"}, description="The orientation, or how the splitter is divided.") public void setOrientation(int orientation) 设置分隔器的方向,或者分隔器如何分隔。选项包括:- JSplitPane.VERTICAL_SPLIT(组件上方/下方的方向)
- JSplitPane.HORIZONTAL_SPLIT(组件左侧/右侧的方向)
- 参数:
-
orientation- 一个整数,指定方向 - 抛出:
-
IllegalArgumentException- 如果方向不是HORIZONTAL_SPLIT或VERTICAL_SPLIT之一。
-
getOrientation
public int getOrientation()返回方向。- 返回:
- 一个整数,表示方向
- 参见:
-
setContinuousLayout
@BeanProperty(description="Whether the child components are continuously redisplayed and laid out during user intervention.") public void setContinuousLayout(boolean newContinuousLayout) 设置continuousLayout属性的值,必须为true,以便在用户干预期间连续重新显示和布局子组件。此属性的默认值取决于外观和感觉。某些外观和感觉可能不支持连续布局;它们将忽略此属性。- 参数:
-
newContinuousLayout- 如果组件应在分隔条位置更改时连续重绘,则为true - 参见:
-
isContinuousLayout
public boolean isContinuousLayout()获取continuousLayout属性。- 返回:
-
continuousLayout属性的值 - 参见:
-
setResizeWeight
@BeanProperty(description="Specifies how to distribute extra space when the split pane resizes.") public void setResizeWeight(double value) 指定在分割窗格大小更改时如何分配额外空间。值为0(默认值)表示右侧/底部组件获得所有额外空间(左侧/顶部组件固定),而值为1表示左侧/顶部组件获得所有额外空间(右侧/底部组件固定)。具体来说,左侧/顶部组件获得(权重*差异)额外空间,右侧/底部组件获得(1-权重)*差异额外空间。- 参数:
-
value- 如上所述 - 抛出:
-
IllegalArgumentException- 如果value小于0或大于1 - 自:
- 1.3
-
getResizeWeight
public double getResizeWeight()返回确定如何分配额外空间的数字。- 返回:
- 在调整分割窗格大小时如何分配额外空间
- 自:
- 1.3
-
resetToPreferredSizes
public void resetToPreferredSizes()根据子组件的首选大小布局JSplitPane布局。这可能会导致更改分隔条位置。 -
setDividerLocation
@BeanProperty(description="The location of the divider.") public void setDividerLocation(double proportionalLocation) 将分隔条位置设置为JSplitPane大小的百分比。此方法是基于
setDividerLocation(int)实现的。此方法立即根据当前大小更改分割窗格的大小。如果分割窗格没有正确实现并显示在屏幕上,则此方法将不起作用(新的分隔条位置将变为(当前大小*比例位置),即0)。- 参数:
-
proportionalLocation- 一个双精度浮点值,指定百分比,从零(顶部/左侧)到1.0(底部/右侧) - 抛出:
-
IllegalArgumentException- 如果指定位置小于0或大于1.0
-
setDividerLocation
@BeanProperty(description="The location of the divider.") public void setDividerLocation(int location) 设置分隔条位置。这将传递给外观和感觉实现,然后通知侦听器。小于0的值意味着分隔条应重置为尝试遵守左侧/顶部组件的首选大小的值。通知侦听器后,通过setLastDividerLocation更新最后的分隔条位置。- 参数:
-
location- 一个整数,指定UI特定值(通常是像素计数)
-
getDividerLocation
public int getDividerLocation()返回传递给setDividerLocation的最后一个值。从此方法返回的值可能与实际分隔条位置不同(如果setDividerLocation传递的值大于当前大小)。- 返回:
- 一个整数,指定分隔条的位置
-
getMinimumDividerLocation
@BeanProperty(bound=false, description="The minimum location of the divider from the L&F.") public int getMinimumDividerLocation()从外观和感觉实现返回分隔条的最小位置。- 返回:
-
一个整数,指定最小位置的UI特定值(通常是像素计数);如果UI为
null,则返回-1
-
getMaximumDividerLocation
从外观和感觉实现返回分隔条的最大位置。- 返回:
-
一个整数,指定最大位置的UI特定值(通常是像素计数);如果UI为
null,则返回-1
-
remove
从面板中移除子组件component。根据需要重置leftComponent或rightComponent实例变量。 -
remove
public void remove(int index) 从指定索引处移除Component。根据需要更新leftComponent和rightComponent实例变量,然后发送消息给父类。 -
removeAll
public void removeAll()从分割窗格中移除所有子组件。重置leftComonent和rightComponent实例变量。 -
isValidateRoot
返回true,以便在此JSplitPane的任何后代上调用revalidate将导致排队请求,该请求将验证JSplitPane及其所有后代。- 覆盖:
-
isValidateRoot在类JComponent中 - 返回:
- true
- 参见:
-
addImpl
将指定的组件添加到此分割窗格。如果constraints标识左侧/顶部或右侧/底部子组件,并且先前添加了具有该标识符的组件,则将删除该组件,然后将comp添加到相应位置。如果constraints不是已知标识符之一,则布局管理器可能会抛出IllegalArgumentException。可能的约束对象(字符串)为:
- JSplitPane.TOP
- JSplitPane.LEFT
- JSplitPane.BOTTOM
- JSplitPane.RIGHT
constraints对象为null,则组件将添加到第一个可用位置(如果打开,则为左侧/顶部,否则为右侧/底部)。- 覆盖:
-
addImpl在类Container中 - 参数:
-
comp- 要添加的组件 -
constraints- 指定此组件的布局约束(位置)的Object -
index- 指定容器列表中的索引的整数 - 抛出:
-
IllegalArgumentException- 如果constraints对象与现有组件不匹配 - 参见:
-
paintChildren
子类化以在调用super之后通过finishedPaintingChildren消息UI,以及绘制边框。- 覆盖:
-
paintChildren在类JComponent中 - 参数:
-
g- 用于绘制的Graphics上下文 - 参见:
-
paramString
返回此JSplitPane的字符串表示形式。此方法仅用于调试目的,返回的字符串的内容和格式可能因实现而异。返回的字符串可能为空,但不能为null。- 覆盖:
-
paramString在类JComponent中 - 返回:
-
此
JSplitPane的字符串表示形式
-
getAccessibleContext
@BeanProperty(bound=false, expert=true, description="The AccessibleContext associated with this SplitPane.") public AccessibleContext getAccessibleContext()获取与此JSplitPane关联的AccessibleContext。对于分割窗格,AccessibleContext采用AccessibleJSplitPane的形式。如有必要,将创建一个新的AccessibleJSplitPane实例。- 指定者:
-
getAccessibleContext在接口Accessible中 - 覆盖:
-
getAccessibleContext在类Component中 - 返回:
- 作为此JSplitPane的AccessibleContext的AccessibleJSplitPane
-