本文整理汇总了Java中javafx.scene.input.MouseEvent.getScreenY方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.getScreenY方法的具体用法?Java MouseEvent.getScreenY怎么用?Java MouseEvent.getScreenY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.input.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.getScreenY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onPressed
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void onPressed(MouseEvent event) {
if (event.getButton() == MouseButton.PRIMARY) {
xAtPress = resizerComponent.xProperty().get();
yAtPress = resizerComponent.yProperty().get();
widthAtPress = resizerComponent.widthProperty().get();
heightAtPress = resizerComponent.heightProperty().get();
screenXAtPress = event.getScreenX();
screenYAtPress = event.getScreenY();
lastScreenX = screenXAtPress;
lastScreenY = screenYAtPress;
panXAtPress = panningComponent.panXProperty().get();
panYAtPress = panningComponent.panYProperty().get();
dragActive = true;
if (onResizeStarted != null) {
onResizeStarted.run();
}
event.consume();
}
}
示例4: onMousePressed
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void onMousePressed(MouseEvent event) {
// Don't start drag if shortcut is down because the node might be about to be deselected.
if (event.getButton() == MouseButton.PRIMARY && !event.isShortcutDown()) {
screenXAtPress = event.getScreenX();
screenYAtPress = event.getScreenY();
lastScreenX = screenXAtPress;
lastScreenY = screenYAtPress;
panXAtPress = panningComponent.panXProperty().get();
panYAtPress = panningComponent.panYProperty().get();
xAtPress = node.getLayoutX();
yAtPress = node.getLayoutY();
dragActive = true;
inertiaOvercome = false;
if (onDragStarted != null) {
onDragStarted.run();
}
event.consume();
}
}
示例5: 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;
}
}
}
示例6: tabPaneResizeElementDragged
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@FXML
private void tabPaneResizeElementDragged(final MouseEvent event) {
final double mouseY = event.getScreenY();
double newHeight = tabPaneContainer.getMaxHeight() - (mouseY - tabPanePreviousY);
newHeight = Math.max(35, newHeight);
tabPaneContainer.setMaxHeight(newHeight);
tabPanePreviousY = mouseY;
}
示例7: onDragged
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void onDragged(MouseEvent event) {
if (event.getButton() == MouseButton.PRIMARY) {
if (dragActive) {
lastScreenX = event.getScreenX();
lastScreenY = event.getScreenY();
if (onResized != null && event.getSource() instanceof Region) {
Rectangle2D result = calculateNewSize((Region) event.getSource());
if (result != null) {
onResized.accept(result);
}
}
}
event.consume();
}
}
示例8: onMouseDragged
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void onMouseDragged(MouseEvent event) {
if (event.getButton() == MouseButton.PRIMARY) {
if (dragActive && (inertiaOvercome || isDraggedFarEnoughToOvercomeInertia(event.getScreenX(), event.getScreenY()))) {
inertiaOvercome = true;
lastScreenX = event.getScreenX();
lastScreenY = event.getScreenY();
if (onDragged != null) {
onDragged.accept(calculateDragDelta());
}
panIfOutsideAxisBounds(event);
}
event.consume();
}
}
示例9: panIfOutsideAxisBounds
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void panIfOutsideAxisBounds(MouseEvent event) {
Point2D rootOriginInScreen = panningComponent.getRoot().localToScreen(0, 0);
double mouseXRelativeToComponent = event.getScreenX() - rootOriginInScreen.getX();
double mouseYRelativeToComponent = event.getScreenY() - rootOriginInScreen.getY();
if (mouseXRelativeToComponent <= 0) {
if (!isRunning(timelineX)) {
startPanAnimation(-getAnimationSpeed(), timelineX, animatedPanX, panningComponent.panXProperty());
}
} else if (mouseXRelativeToComponent >= panningComponent.getRoot().getWidth()) {
if (!isRunning(timelineX)) {
startPanAnimation(getAnimationSpeed(), timelineX, animatedPanX, panningComponent.panXProperty());
}
} else {
timelineX.stop();
}
if (mouseYRelativeToComponent <= 0) {
if (!isRunning(timelineY)) {
startPanAnimation(-getAnimationSpeed(), timelineY, animatedPanY, panningComponent.panYProperty());
}
} else if (mouseYRelativeToComponent >= panningComponent.getRoot().getHeight()) {
if (!isRunning(timelineY)) {
startPanAnimation(getAnimationSpeed(), timelineY, animatedPanY, panningComponent.panYProperty());
}
} else {
timelineY.stop();
}
}
示例10: onMousePressed
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void onMousePressed(MouseEvent event) {
if (event.getButton() == MouseButton.SECONDARY) {
contentXAtPress = view.getContent().getLayoutX();
contentYAtPress = view.getContent().getLayoutY();
screenXAtPress = event.getScreenX();
screenYAtPress = event.getScreenY();
setSceneCursor(Cursor.MOVE);
panningActive = true;
}
}
示例11: onMouseDragged
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void onMouseDragged(MouseEvent event) {
if (event.getButton() == MouseButton.SECONDARY && panningActive) {
double deltaX = event.getScreenX() - screenXAtPress;
double deltaY = event.getScreenY() - screenYAtPress;
view.getContent().setLayoutX(contentXAtPress + deltaX);
view.getContent().setLayoutY(contentYAtPress + deltaY);
}
}
示例12: handle
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@Override
public void handle(MouseEvent event)
{
x = stage.getX() - event.getScreenX();
y = stage.getY() - event.getScreenY();
}
示例13: handleSingleClick
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void handleSingleClick(MouseEvent evt, Node node, LocalDate date) {
if (!(evt.getButton() == MouseButton.PRIMARY)) {
return;
}
YearMonthView view = getSkinnable();
switch (view.getClickBehaviour()) {
case NONE:
break;
case SHOW_DETAILS:
Callback<DateDetailsParameter, Boolean> callback = view.getDateDetailsCallback();
DateDetailsParameter param = new DateDetailsParameter(evt, view, node, date, evt.getScreenX(), evt.getScreenY());
callback.call(param);
break;
case PERFORM_SELECTION:
boolean multiSelect = evt.isShiftDown() || evt.isShortcutDown();
if (!multiSelect || (view.getSelectionMode().equals(SINGLE)
&& !evt.isControlDown())) {
view.getSelectedDates().clear();
}
if (evt.isShiftDown()) {
if (lastSelectedDate != null) {
LocalDate st = lastSelectedDate;
LocalDate et = date;
if (date.isBefore(st)) {
st = date;
et = lastSelectedDate;
}
do {
view.getSelectedDates().add(st);
st = st.plusDays(1);
} while (!et.isBefore(st));
} else {
view.getSelectedDates().clear();
view.getSelectedDates().add(date);
}
} else {
if (view.getSelectedDates().contains(date)) {
view.getSelectedDates().remove(date);
} else {
view.getSelectedDates().add(date);
}
}
lastSelectedDate = date;
if (!date.getMonth().equals(view.getYearMonth().getMonth())) {
view.setDate(date);
}
break;
default:
break;
}
}
示例14: tabPaneResizeElementPressed
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@FXML
private void tabPaneResizeElementPressed(final MouseEvent event) {
tabPanePreviousY = event.getScreenY();
}
示例15: calculateGap
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
/**
* Calculating gap of location between the mouse and the stage on <i>Mouse Moving Event</i>.
* @param event
* @param stage
*/
private void calculateGap(MouseEvent event, Stage stage) {
gap_x = event.getScreenX() - stage.getX();
gap_y = event.getScreenY() - stage.getY();
}