java.lang.Object
javax.swing.plaf.basic.BasicSplitPaneDivider.DragController
处理水平分割窗格的拖动会话期间的事件。这会不断地发送
dragDividerTo 消息,然后在完成时发送 finishDraggingTo 消息。创建实例时,应使用 isValid 发送消息以确保可以发生拖动(如果两个视图无法调整大小,则不允许拖动)。
警告: 该类的序列化对象将不兼容未来的Swing版本。当前的序列化支持适用于短期存储或在运行相同Swing版本的应用程序之间的RMI。从1.4开始,已将所有JavaBeans的长期存储支持添加到 java.beans 包中。请参阅 XMLEncoder。
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcompleteDrag(int x, int y) 使用鼠标事件的新位置发送 finishDraggingTo 消息。protected void使用鼠标事件的新位置发送 finishDraggingTo 消息。protected voidcontinueDrag(int newX, int newY) 使用鼠标事件的新位置发送 dragDividerTo 消息。protected void使用鼠标事件的新位置发送 dragDividerTo 消息。protected intgetNeededLocation(int x, int y) 返回 x 参数,因为这用于水平分割。protected booleanisValid()如果拖动会话有效,则返回true。protected int根据传入的 MouseEvent 返回要将分隔线放置的新位置。
-
Constructor Details
-
DragController
构造一个DragController的新实例。- 参数:
-
e- 鼠标事件
-
-
Method Details
-
isValid
protected boolean isValid()如果拖动会话有效,则返回true。- 返回:
-
如果拖动会话有效,则返回
true
-
positionForMouseEvent
根据传入的 MouseEvent 返回要将分隔线放置的新位置。- 参数:
-
e- 鼠标事件 - 返回:
- 新位置
-
getNeededLocation
protected int getNeededLocation(int x, int y) 返回 x 参数,因为这用于水平分割。- 参数:
-
x- X坐标 -
y- Y坐标 - 返回:
- X参数
-
continueDrag
protected void continueDrag(int newX, int newY) 使用鼠标事件的新位置发送 dragDividerTo 消息。- 参数:
-
newX- X坐标 -
newY- Y坐标
-
continueDrag
使用鼠标事件的新位置发送 dragDividerTo 消息。- 参数:
-
e- 鼠标事件
-
completeDrag
protected void completeDrag(int x, int y) 使用鼠标事件的新位置发送 finishDraggingTo 消息。- 参数:
-
x- X坐标 -
y- Y坐标
-
completeDrag
使用鼠标事件的新位置发送 finishDraggingTo 消息。- 参数:
-
e- 鼠标事件
-