本文整理匯總了Java中javafx.scene.shape.Rectangle.setOnMouseReleased方法的典型用法代碼示例。如果您正苦於以下問題:Java Rectangle.setOnMouseReleased方法的具體用法?Java Rectangle.setOnMouseReleased怎麽用?Java Rectangle.setOnMouseReleased使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.shape.Rectangle
的用法示例。
在下文中一共展示了Rectangle.setOnMouseReleased方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initLifelineHandleActions
import javafx.scene.shape.Rectangle; //導入方法依賴的package包/類
public void initLifelineHandleActions(SequenceObjectView nodeView){
Rectangle rectangleHandle = nodeView.getLifelineHandle();
rectangleHandle.setOnMousePressed(event -> {
if(tool == ToolEnum.SELECT){
mode = Mode.DRAGGING;
previousMoveY = event.getSceneY();
}
});
rectangleHandle.setOnMouseDragged(event -> {
double offsetY = (event.getSceneY() - previousMoveY)*(1/drawPane.getScaleY());
previousMoveX = event.getSceneX();
previousMoveY = event.getSceneY();
if(mode == Mode.DRAGGING){
SequenceObject node = (SequenceObject) nodeView.getRefNode();
node.setLifelineLength(node.getLifelineLength() + offsetY);
}
});
rectangleHandle.setOnMouseReleased(event -> {
mode = Mode.NO_MODE;
previousMoveX = 0;
previousMoveY = 0;
});
}