本文整理匯總了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();
}
}