java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.plaf.basic.BasicSplitPaneDivider
BasicSplitPaneUI使用的分隔符。子类可能希望重写paint方法以执行更有趣的操作。边框效果是在BasicSplitPaneUI中绘制的,因此如果您不喜欢该边框,请在那里重置它。要根据条件从某些区域拖动,请在子类的mousePressed方法中调用super以开始拖动。
警告: 该类的序列化对象将不兼容未来的Swing版本。当前的序列化支持适用于短期存储或在运行相同Swing版本的应用程序之间进行RMI。从1.4开始,已将所有JavaBeans的长期存储支持添加到java.beans
包中。请参阅XMLEncoder
。
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
用于布局BasicSplitPaneDivider
。protected class
处理HORIZONTAL_SPLIT方向分隔窗格的拖动会话期间的事件。protected class
MouseHandler负责将鼠标事件(释放、拖动等)转换为适当的DragController方法。protected class
处理VERTICAL_SPLIT方向分隔窗格的拖动会话期间的事件。Nested classes/interfaces declared in class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces declared in class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
分隔符的大小。protected BasicSplitPaneDivider.DragController
处理鼠标拖动消息以执行实际拖动。protected Component
用于非连续布局模式的分隔符。protected JButton
用于快速切换左侧组件的按钮。protected BasicSplitPaneDivider.MouseHandler
处理来自该类和分隔窗格的鼠标事件。protected static final int
分隔符的偏移量。protected static final int
基于方向的分隔符的宽度或高度BasicSplitPaneUI
在此基础上增加了两个。protected int
JSplitPane的方向。protected JButton
用于快速切换右侧组件的按钮。protected JSplitPane
包含接收器的JSplitPane。protected BasicSplitPaneUI
创建此实例的UI。Fields declared in class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields declared in interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected JButton
创建并返回一个JButton
的实例,可用于折叠分隔窗格中的左侧组件。protected JButton
创建并返回一个JButton
的实例,可用于折叠分隔窗格中的右侧组件。protected void
dragDividerTo
(int location) 通过dragDividerTo向包含此实例的BasicSplitPaneUI发送消息。protected void
finishDraggingTo
(int location) 通过finishDraggingTo向包含此实例的BasicSplitPaneUI发送消息。返回接收器当前所在的SplitPaneUI
。返回此组件的边框,如果当前未设置边框,则返回null。int
返回分隔符的大小,即如果splitpane是HORIZONTAL_SPLIT,则为宽度,如果是VERTICAL_SPLIT,则为高度。如果在此组件上设置了边框,则返回边框的插图,否则调用super.getInsets。返回分隔符的最小大小。返回分隔符的首选大小。boolean
返回鼠标当前是否位于分隔符上。protected void
当包含分隔符的JSplitPane的oneTouchExpandable值更改时发送消息。void
绘制分隔符。protected void
准备拖动的消息。void
属性更改事件,可能来自JSplitPane,将在必要时向updateOrientation发送消息。void
设置正在使用接收器的SplitPaneUI
。void
设置此组件的边框。void
setDividerSize
(int newSize) 将分隔符的大小设置为newSize
。protected void
setMouseOver
(boolean mouseOver) 设置鼠标当前是否位于分隔符上。Methods declared in class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getListeners, getMaximumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree
Methods declared in class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
ONE_TOUCH_SIZE
protected static final int ONE_TOUCH_SIZE基于方向的分隔符的宽度或高度BasicSplitPaneUI
在此基础上增加了两个。- 参见:
-
ONE_TOUCH_OFFSET
protected static final int ONE_TOUCH_OFFSET分隔符的偏移量。- 参见:
-
dragger
处理鼠标拖动消息以执行实际拖动。 -
splitPaneUI
创建此实例的UI。 -
dividerSize
protected int dividerSize分隔符的大小。 -
splitPane
包含接收器的JSplitPane。 -
mouseHandler
处理来自该类和分隔窗格的鼠标事件。处理分隔窗格的鼠标事件,因为您希望能够在单击分隔符的边框时拖动,而该边框不是由分隔符绘制的。 -
orientation
protected int orientationJSplitPane的方向。 -
leftButton
用于快速切换左侧组件的按钮。 -
rightButton
用于快速切换右侧组件的按钮。
-
-
Constructor Details
-
BasicSplitPaneDivider
创建BasicSplitPaneDivider
的实例。注册此实例以接收鼠标事件和鼠标拖动事件。- 参数:
-
ui
-BasicSplitPaneUI
的一个实例
-
-
Method Details
-
setBasicSplitPaneUI
设置正在使用接收器的SplitPaneUI
。- 参数:
-
newUI
- 新的SplitPaneUI
-
getBasicSplitPaneUI
返回接收器当前所在的SplitPaneUI
。- 返回:
-
接收器当前所在的
SplitPaneUI
-
setDividerSize
public void setDividerSize(int newSize) 将分隔符的大小设置为newSize
。即如果splitpane是HORIZONTAL_SPLIT
,则为宽度,如果是VERTICAL_SPLIT
,则为高度。分隔符大小newSize < 0
将被忽略。- 参数:
-
newSize
- 一个新的大小
-
getDividerSize
public int getDividerSize()返回分隔符的大小,即如果splitpane是HORIZONTAL_SPLIT,则为宽度,如果是VERTICAL_SPLIT,则为高度。- 返回:
- 分隔符的大小
-
setBorder
设置此组件的边框。- 参数:
-
border
- 一个新的边框 - 自1.3起
-
getBorder
返回此组件的边框,如果当前未设置边框,则返回null。- 返回:
- 此组件的边框对象
- 自1.3起
- 参见:
-
getInsets
如果在此组件上设置了边框,则返回边框的插图,否则调用super.getInsets。 -
setMouseOver
protected void setMouseOver(boolean mouseOver) 设置鼠标当前是否位于分隔符上。- 参数:
-
mouseOver
- 鼠标当前是否位于分隔符上 - 自1.5起
-
isMouseOver
public boolean isMouseOver()返回鼠标当前是否位于分隔符上。- 返回:
- 鼠标当前是否位于分隔符上
- 自1.5起
-
getPreferredSize
返回分隔符的首选大小。- 覆盖:
-
getPreferredSize
在类Container
- 实现注意:
-
在当前实现中,如果splitpane是HORIZONTAL_SPLIT,则首选大小是从
getDividerSize
像素的宽度和1像素的高度获取的。如果splitpane是VERTICAL_SPLIT,则首选大小是从getDividerSize
像素的高度和1像素的宽度获取的。 - 返回:
-
包含
BasicSplitPaneDivider
的首选大小的Dimension
对象 - 参见:
-
getMinimumSize
返回分隔符的最小大小。- 覆盖:
-
getMinimumSize
在类Container
中 - 实现说明:
-
在当前实现中,如果分隔窗格是HORIZONTAL_SPLIT,则最小尺寸从
getDividerSize
像素的宽度和1像素的高度中获取。如果分隔窗格是VERTICAL_SPLIT,则最小尺寸从getDividerSize
像素的高度和1像素的宽度中获取。 - 返回:
-
包含
BasicSplitPaneDivider
最小尺寸的Dimension
对象 - 参见:
-
propertyChange
属性更改事件,可能来自JSplitPane,将在必要时更新方向。- 指定者:
-
propertyChange
在接口PropertyChangeListener
中 - 参数:
-
e
- 描述事件源和已更改属性的PropertyChangeEvent对象
-
paint
绘制分隔线。 -
oneTouchExpandableChanged
protected void oneTouchExpandableChanged()当包含分隔线的JSplitPane的oneTouchExpandable值更改时发送消息。如果leftButton
和rightButton
为null,并且相应的JSplitPane支持oneTouchExpandable属性,则将创建它们。同时也使相应的JSplitPane失效。 -
createLeftOneTouchButton
创建并返回一个JButton
实例,可用于折叠分隔窗格中的左组件。- 返回:
-
一个
JButton
实例
-
createRightOneTouchButton
创建并返回一个JButton
实例,可用于折叠分隔窗格中的右组件。- 返回:
-
一个
JButton
实例
-
prepareForDragging
protected void prepareForDragging()准备拖动的消息。通过startDragging向BasicSplitPaneUI发送消息。 -
dragDividerTo
protected void dragDividerTo(int location) 通过dragDividerTo向包含此实例的BasicSplitPaneUI发送消息。- 参数:
-
location
- 位置
-
finishDraggingTo
protected void finishDraggingTo(int location) 通过finishDraggingTo向包含此实例的BasicSplitPaneUI发送消息。- 参数:
-
location
- 位置
-