本文整理汇总了Java中javafx.scene.input.MouseEvent.isConsumed方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.isConsumed方法的具体用法?Java MouseEvent.isConsumed怎么用?Java MouseEvent.isConsumed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.input.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.isConsumed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: press
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void press(MouseEvent e) {
Node node = get();
if (isEnable() && e.isConsumed() == false && node != null) {
Corner corner = calcCorner(e);
if (corner != Corner.CENTER) {
pressedCorner = corner;
startX = e.getScreenX();
startY = e.getScreenY();
startWidth = width.get() == -1 ? node.prefWidth(-1) : width.get();
startHeight = height.get() == -1 ? node.prefHeight(-1) : height.get();
startPosX = node.getLayoutX();
startPosY = node.getLayoutY();
e.consume();
}
}
}
示例2: drag
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void drag(MouseEvent e) {
Node node = get();
if (isEnable() && pressedCorner != null && e.isConsumed() == false && node != null) {
double dx = e.getScreenX() - startX;
if (pressedCorner.horizontal == HorizontalDirection.RIGHT) {
width.set(MathUtil.toRange(startWidth + dx, minWidth.get(), maxWidth.get()));
} else if (pressedCorner.horizontal == HorizontalDirection.LEFT) {
width.set(MathUtil.toRange(startWidth - dx, minWidth.get(), maxWidth.get()));
node.setLayoutX(startWidth + startPosX - width.get());
}
double dy = e.getScreenY() - startY;
if (pressedCorner.vertical == VerticalDirection.DOWN) {
height.set(MathUtil.toRange(startHeight + dy, minHeight.get(), maxHeight.get()));
} else if (pressedCorner.vertical == VerticalDirection.UP) {
height.set(MathUtil.toRange(startHeight - dy, minHeight.get(), maxHeight.get()));
node.setLayoutY(startHeight + startPosY - height.get());
}
e.consume();
}
}
示例3: press
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@Override
public void press(MouseEvent e) {
Node node = get();
if (isEnable() && e.isConsumed() == false && node != null) {
Bounds boundsInLocal = node.getBoundsInLocal();
if (canDrag(node.screenToLocal(e.getScreenX(), e.getScreenY()), boundsInLocal.getMaxX(), boundsInLocal.getMaxY())) {
startX = e.getScreenX() - node.getLayoutX();
startY = e.getScreenY() - node.getLayoutY();
e.consume();
pressed = true;
}
}
}
示例4: drag
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@Override
public void drag(MouseEvent e) {
Node node = get();
if (pressed && isEnable() && e.isConsumed() == false && node != null) {
node.setLayoutX(MathUtil.toRange(e.getScreenX() - startX, minX.get(), maxX.get()));
node.setLayoutY(MathUtil.toRange(e.getScreenY() - startY, minY.get(), maxY.get()));
e.consume();
}
}