Java Code Examples for javafx.scene.input.MouseEvent

The following examples show how to use javafx.scene.input.MouseEvent. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: uip-pc2   Source File: Resumen.java    License: MIT License 6 votes vote down vote up
public void salir(MouseEvent mouseEvent) {
    Stage stage = (Stage) salir.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Login.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example 2
private void showContextMenu(MouseEvent event) {
	menu.hide();
	final List<IliasTreeNode> selectedNodes = ((ResultList) event.getSource())
			.getSelectionModel().getSelectedItems();
	if (selectedNodes.isEmpty() || selectedNodes == null) {
		return;
	}
	if (selectedNodes.size() == 1) {
		dashboard.getCoursesTreeView().selectFile((IliasFile) selectedNodes.get(0));
	}

	if (event.getButton() == MouseButton.SECONDARY) {
		menu = new FileContextMenu(dashboard).createMenu(selectedNodes, event);
		menu.show(this, event.getScreenX(), event.getScreenY());
	}
}
 
Example 3
/**
 * Based on mouse position returns dock side
 *
 * @param mouseEvent
 * @return DOCK_LEFT,DOCK_RIGHT,DOCK_TOP
 */
int getDockSide(MouseEvent mouseEvent) {
    double minX = Double.POSITIVE_INFINITY;
    double minY = Double.POSITIVE_INFINITY;
    double maxX = 0;
    double maxY = 0;
    // Get "big" screen bounds
    ObservableList<Screen> screens = Screen.getScreens();
    for (Screen screen : screens) {
        Rectangle2D visualBounds = screen.getVisualBounds();
        minX = Math.min(minX, visualBounds.getMinX());
        minY = Math.min(minY, visualBounds.getMinY());
        maxX = Math.max(maxX, visualBounds.getMaxX());
        maxY = Math.max(maxY, visualBounds.getMaxY());
    }
    // Dock Left
    if (mouseEvent.getScreenX() == minX) {
        return DOCK_LEFT;
    } else if (mouseEvent.getScreenX() >= maxX - 1) { // MaxX returns the width? Not width -1 ?!
        return DOCK_RIGHT;
    } else if (mouseEvent.getScreenY() <= minY) {   // Mac menu bar
        return DOCK_TOP;
    }
    return 0;
}
 
Example 4
/**
 * Adds an alignment handler to each of the given joint skins.
 *
 * <p>
 * This is a mouse-pressed handler which checks for appropriate adjacent joints and sets alignment targets in the
 * joint's {@link DraggableBox} root node, so that the joint will align to adjacent joints when dragged near them.
 * </p>
 *
 * @param jointSkins all joint skin instances belonging to a connection
 */
public void addAlignmentHandlers(final List<GJointSkin> jointSkins) {

    final Map<GJointSkin, EventHandler<MouseEvent>> oldAlignmentHandlers = new HashMap<>(alignmentHandlers);
    alignmentHandlers.clear();

    for (final GJointSkin jointSkin : jointSkins) {

        final EventHandler<MouseEvent> oldHandler = oldAlignmentHandlers.get(jointSkin);

        final DraggableBox root = jointSkin.getRoot();

        if (oldHandler != null) {
            root.removeEventHandler(MouseEvent.MOUSE_PRESSED, oldHandler);
        }

        final EventHandler<MouseEvent> newHandler = event -> {
            addHorizontalAlignmentTargets(jointSkin, jointSkins);
            addVerticalAlignmentTargets(jointSkin, jointSkins);
        };

        root.addEventHandler(MouseEvent.MOUSE_PRESSED, newHandler);
        alignmentHandlers.put(jointSkin, newHandler);
    }
}
 
Example 5
Source Project: Medusa   Source File: ModernSkin.java    License: Apache License 2.0 6 votes vote down vote up
public void handleMouseEvent(final MouseEvent EVENT) {
    if (gauge.isDisabled()) return;
    final EventType TYPE = EVENT.getEventType();
    if (MouseEvent.MOUSE_PRESSED.equals(TYPE)) {
        gauge.fireEvent(gauge.BTN_PRESSED_EVENT);
        centerKnob.setFill(new LinearGradient(0.5 * size, 0.2708333333333333 * size,
                                              0.5 * size, 0.7291666666666666 * size,
                                              false, CycleMethod.NO_CYCLE,
                                              new Stop(0.0, Color.rgb(31, 31, 31)),
                                              new Stop(1.0, Color.rgb(69, 70, 73))));
        valueText.setTranslateY(size * 0.501);
        subTitleText.setTranslateY(size * 0.3525);
        unitText.setTranslateY(size * 0.6675);
    } else if (MouseEvent.MOUSE_RELEASED.equals(TYPE)) {
        gauge.fireEvent(gauge.BTN_RELEASED_EVENT);
        centerKnob.setFill(new LinearGradient(0.5 * size, 0.2708333333333333 * size,
                                              0.5 * size, 0.7291666666666666 * size,
                                              false, CycleMethod.NO_CYCLE,
                                              new Stop(0.0, Color.rgb(69, 70, 73)),
                                              new Stop(1.0, Color.rgb(31, 31, 31))));
        valueText.setTranslateY(size * 0.5);
        subTitleText.setTranslateY(size * 0.35);
        unitText.setTranslateY(size * 0.67);
    }
}
 
Example 6
@FXML
public void mouseMoved(MouseEvent event) {
	if (freeformButton.isSelected()) {
		drawTempPolygonEdge(event);
	}

	if (!cursorRegion.isPresent() || cursorButton.isSelected()) return;

	final Node selected = cursorRegion.get();

	lastMouseX = event.getX() - (selected.getLayoutBounds().getWidth() / 2);
	lastMouseY = event.getY() - (selected.getLayoutBounds().getHeight() / 2);

	if (lastMouseX < 0) lastMouseX = 0;
	if (lastMouseY < 0) lastMouseY = 0;

	if (event.getX() + (selected.getLayoutBounds().getWidth() / 2) <= canvasPane.getWidth())
		selected.setLayoutX(lastMouseX - selected.getLayoutBounds().getMinX());

	if (event.getY() + (selected.getLayoutBounds().getHeight() / 2) <= canvasPane.getHeight())
		selected.setLayoutY(lastMouseY - selected.getLayoutBounds().getMinY());

	event.consume();
}
 
Example 7
public void addMenuItem(final String iconPath,
    final EventHandler<MouseEvent> eventHandler) {

final RadialGradient backGradient = new RadialGradient(0, 0, 0, 0,
	radius.get(), false, CycleMethod.NO_CYCLE, new Stop(0,
		BACK_GRADIENT_COLOR), new Stop(1, Color.TRANSPARENT));

final RadialGradient backSelectGradient = new RadialGradient(0, 0, 0,
	0, radius.get(), false, CycleMethod.NO_CYCLE, new Stop(0,
		BACK_SELECT_GRADIENT_COLOR), new Stop(1,
		Color.TRANSPARENT));

final RadialMenuItem item = RadialMenuItemBuilder.create()
	.length(length).graphic(new Group(getImageView(iconPath)))
	.backgroundFill(backGradient)
	.backgroundMouseOnFill(backSelectGradient)
	.innerRadius(innerRadius).radius(radius).offset(offset)
	.clockwise(true).backgroundVisible(true).strokeVisible(false)
	.build();

item.setOnMouseClicked(eventHandler);

items.add(item);
itemsContainer.getChildren().addAll(item);
   }
 
Example 8
Source Project: chart-fx   Source File: CrosshairIndicator.java    License: Apache License 2.0 6 votes vote down vote up
private void updateLabel(final MouseEvent event, final Bounds plotAreaBounds) {
    coordinatesLabel.setText(formatLabelText(getLocationInPlotArea(event)));

    final double width = coordinatesLabel.prefWidth(-1);
    final double height = coordinatesLabel.prefHeight(width);

    double xLocation = event.getX() + CrosshairIndicator.LABEL_X_OFFSET;
    double yLocation = event.getY() + CrosshairIndicator.LABEL_Y_OFFSET;

    if (xLocation + width > plotAreaBounds.getMaxX()) {
        xLocation = event.getX() - CrosshairIndicator.LABEL_X_OFFSET - width;
    }
    if (yLocation + height > plotAreaBounds.getMaxY()) {
        yLocation = event.getY() - CrosshairIndicator.LABEL_Y_OFFSET - height;
    }
    coordinatesLabel.resizeRelocate(xLocation, yLocation, width, height);
}
 
Example 9
Source Project: DashboardFx   Source File: SkinAction.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void setupListeners() {

        final TextField textField = getSkinnable();

        button.setOnMouseReleased(event -> mouseReleased());
        button.setOnMousePressed(event -> mousePressed());
        button.addEventFilter(MouseEvent.MOUSE_CLICKED, event -> {
            if(graphic.isVisible())button.setCursor(Cursor.HAND);
            else button.setCursor(Cursor.DEFAULT);

        });
        button.setOnMouseMoved(event -> {
            if(graphic.isVisible())button.setCursor(Cursor.HAND);
            else button.setCursor(Cursor.DEFAULT);
        });
        textField.textProperty().addListener((observable, oldValue, newValue) -> textChanged());
        textField.focusedProperty().addListener((observable, oldValue, newValue) -> focusChanged());

        button.setMinWidth(10);
        button.setMinHeight(10);
        graphic.setMinWidth(10);
        graphic.setMinHeight(10);
    }
 
Example 10
Source Project: paintera   Source File: Scene3DHandler.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public void drag(final MouseEvent event)
{
	synchronized (getTransformLock())
	{
		LOG.trace("drag - translate");
		final double dX = event.getX() - getStartX();
		final double dY = event.getY() - getStartY();

		LOG.trace("dx " + dX + " dy: " + dY);

		final Affine target = affine.clone();
		target.prependTranslation(2 * dX / viewer.getHeight(), 2 * dY / viewer.getHeight());

		InvokeOnJavaFXApplicationThread.invoke(() -> setAffine(target));

		setStartX(getStartX() + dX);
		setStartY(getStartY() + dY);
	}
}
 
Example 11
@Override
public void click(MouseEvent event) {
	if (event.getClickCount() == 2) {
		// double click, so open nested graph, if it exists
		final Graph nestedGraph = getHost().getContent().getNestedGraph();
		if (nestedGraph != null) {
			IViewer viewer = getHost().getRoot().getViewer();
			try {
				// navigate to nested graph
				viewer.getDomain().execute(new NavigateOperation(viewer, nestedGraph, true),
						new NullProgressMonitor());
			} catch (ExecutionException e) {
				throw new RuntimeException(e);
			}
		}
	}
}
 
Example 12
Source Project: G-Earth   Source File: ExtensionItemContainer.java    License: MIT License 6 votes vote down vote up
void initExtension(){
    if (onExit != null) {
        exitButton.removeEventHandler(MouseEvent.MOUSE_CLICKED, onExit);
        clickButton.removeEventHandler(MouseEvent.MOUSE_CLICKED, onClick);
    }
    onExit = event -> item.getRemoveClickObservable().fireEvent();
    onClick = event -> item.getClickedObservable().fireEvent();

    exitButton.addEventHandler(MouseEvent.MOUSE_CLICKED, onExit);
    clickButton.addEventHandler(MouseEvent.MOUSE_CLICKED, onClick);

    ExtensionItemContainer this2 = this;
    item.getDeletedObservable().addListener(() -> Platform.runLater(() -> {
        if (item.isInstalledExtension()) {
            setBackground(new Background(new BackgroundFill(Paint.valueOf("#cccccc"),null, null)));
            getChildren().remove(buttonsBox);
            add(additionalButtonBox, 4, 0);
            reloadButton.setVisible(true);
        }
        else {
            parent.getChildren().remove(this2);
        }
    }));
}
 
Example 13
Source Project: PDF4Teachers   Source File: TextTreeItem.java    License: Apache License 2.0 5 votes vote down vote up
public void setup(){

		if(core != null){
			// bindings with the core
			fontProperty().bind(core.fontProperty());
			core.textProperty().addListener(textChangeListener);
			core.fillProperty().addListener(colorChangeListener);
		}

		// Setup les éléments graphiques
		menu = TextTreeView.getNewMenu(this);

		onMouseCLick = (MouseEvent mouseEvent) -> {
			if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){
				addToDocument(false);
				// Update the sorting if is sort by utils
				if(getType() == TextTreeSection.FAVORITE_TYPE){
					if(MainWindow.lbTextTab.treeView.favoritesSection.sortManager.getSelectedButton().getText().equals(TR.tr("Utilisation"))){
						MainWindow.lbTextTab.treeView.favoritesSection.sortManager.simulateCall();
					}
				}else if(getType() == TextTreeSection.LAST_TYPE){
					if(MainWindow.lbTextTab.treeView.lastsSection.sortManager.getSelectedButton().getText().equals(TR.tr("Utilisation"))){
						MainWindow.lbTextTab.treeView.lastsSection.sortManager.simulateCall();
					}
				}
			}
		};
		name.setFill(StyleManager.convertColor(color.get()));
		colorProperty().addListener((observable, oldValue, newValue) -> {
			name.setFill(StyleManager.convertColor(newValue));
		});

		name.fontProperty().bind(Bindings.createObjectBinding(this::getListFont, fontProperty(), Main.settings.smallFontInTextsListProperty()));

		updateIcon();
	}
 
Example 14
Source Project: MyBox   Source File: IccProfileEditorController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
public void popSave(MouseEvent event) {
    if (isIccFile) {
        return;
    }
    super.popSaveAs(event);
}
 
Example 15
private void componentSelectOnClick(final boolean newValue) {
    if (newValue) {
        targetScene.addEventFilter(MouseEvent.MOUSE_MOVED, sceneHoverListener);
        targetScene.addEventFilter(MouseEvent.MOUSE_PRESSED, scenePressListener);

        ((Stage) targetWindow).toFront();
    } else {
        targetScene.removeEventFilter(MouseEvent.MOUSE_MOVED, sceneHoverListener);
        targetScene.removeEventFilter(MouseEvent.MOUSE_PRESSED, scenePressListener);
        if (componentHighLighter != null) {
            SCUtils.removeFromNode(target, componentHighLighter);
        }
    }
}
 
Example 16
Source Project: MyBox   Source File: MediaTableController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
public void popMediasLink(MouseEvent event) {
    if (AppVariables.fileRecentNumber <= 0) {
        return;
    }
    RecentVisitMenu menu = new RecentVisitMenu(this, event) {
        @Override
        public List<VisitHistory> recentFiles() {
            List<VisitHistory> recent = VisitHistory.getRecentStreamMedia();
            return recent;
        }

        public List<String> paths() {
            return null;
        }

        @Override
        public List<VisitHistory> recentPaths() {
            return null;
        }

        @Override
        public void handleSelect() {
            addLinkAction();
        }

        @Override
        public void handleFile(String address) {
            addLink(address);
        }

        @Override
        public void handlePath(String fname) {
        }

    };
    menu.setExamples(examples);
    menu.pop();
}
 
Example 17
@FXML private void clickPointsTo(MouseEvent event) {
	try {
		if (event.getClickCount() == 2) {
			selectOption(pointsToList.getSelectionModel().getSelectedItem());
		}
	} catch (Exception e) {
		ExceptionController.display(e);
	}
}
 
Example 18
Source Project: HealthPlus   Source File: AdminController.java    License: Apache License 2.0 5 votes vote down vote up
public void getSuspendedInfo()
{
    
    AdminController admin = this;
    
    suspendList.setOnMouseClicked(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent event) {
            String tmp = (String)suspendList.getSelectionModel().getSelectedItem();
            String userid = tmp.split("\\t")[0];
            
            System.out.println(tmp);
            System.out.println(userid);
            
            Stage stage= new Stage();
            SysUserController user = new SysUserController(admin,userid);
            user.load();
            Scene scene = new Scene(user);
            stage.setScene(scene);

            Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
            //set Stage boundaries to visible bounds of the main screen
            stage.setX(primaryScreenBounds.getMinX());
            stage.setY(primaryScreenBounds.getMinY());
            stage.setWidth(primaryScreenBounds.getWidth());
            stage.setHeight(primaryScreenBounds.getHeight());

            stage.initStyle(StageStyle.UNDECORATED);
            scene.setFill(null);
            stage.initStyle(StageStyle.TRANSPARENT);
            stage.show();   
            
            
        }
    });
}
 
Example 19
Source Project: OEE-Designer   Source File: BarChartTileSkin.java    License: MIT License 5 votes vote down vote up
@Override protected void registerListeners() {
    super.registerListeners();
    tile.getBarChartItems().addListener(new WeakListChangeListener<>(change -> {
        while (change.next()) {
            if (change.wasAdded()) {
                change.getAddedSubList().forEach(addedItem -> {
                    barChartPane.getChildren().add(addedItem);
                    addedItem.addChartDataEventListener(updateHandler);
                    EventHandler<MouseEvent> clickHandler = e -> tile.fireTileEvent(new TileEvent(EventType.SELECTED_CHART_DATA, addedItem.getChartData()));
                    handlerMap.put(addedItem, clickHandler);
                    addedItem.setOnMousePressed(clickHandler);
                });
                updateChart();
            } else if (change.wasRemoved()) {
                change.getRemoved().forEach(removedItem -> {
                    removedItem.removeChartDataEventListener(updateHandler);
                    removedItem.removeEventHandler(MouseEvent.MOUSE_PRESSED, handlerMap.get(removedItem));
                    barChartPane.getChildren().remove(removedItem);
                });
                updateChart();
            }
        }
    }));

    pane.widthProperty().addListener(paneSizeListener);
    pane.heightProperty().addListener(paneSizeListener);
}
 
Example 20
Source Project: MyBox   Source File: ImagesBlendController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
private void backClicked(MouseEvent event) {
    if (backImage == null || location != ImagesRelativeLocation.Foreground_In_Background) {
        return;
    }
    backView.setCursor(Cursor.HAND);

    int xv = (int) Math.round(event.getX() * backImage.getWidth() / backView.getBoundsInParent().getWidth());
    int yv = (int) Math.round(event.getY() * backImage.getHeight() / backView.getBoundsInParent().getHeight());

    pointX.setText(xv + "");
    pointY.setText(yv + "");
}
 
Example 21
Source Project: CMPDL   Source File: MainWindowController.java    License: MIT License 5 votes vote down vote up
public void switchTheme(MouseEvent mouseEvent) {
    if (darkTheme) {
        CMPDL.mainWindow.getView().setStyle("-fx-base:#ececec;");
    } else {
        CMPDL.mainWindow.getView().setStyle("-fx-base:black;");
    }
    darkTheme = !darkTheme;
}
 
Example 22
Source Project: MyBox   Source File: ImageManufacturePenController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
    @Override
    public void mousePressed(MouseEvent event) {
        if (null == opType || imageView == null || imageView.getImage() == null) {
            return;
        }
        DoublePoint p = imageController.getImageXY(event, imageView);
        imageController.showXY(event, p);

        if (event.getButton() == MouseButton.SECONDARY || p == null) {
            return;
        }

        switch (opType) {
            case Polyline:
                if (lastX == event.getX() && lastY == event.getY()) {
                    return;
                }
                imageController.scrollPane.setPannable(false);
                imageController.maskLineData.add(p);
                lastX = event.getX();
                lastY = event.getY();
                drawPolyline();
                break;
            case DrawLines:
            case Erase:
//            case Mosaic:
//            case Frosted:
                imageController.scrollPane.setPannable(false);
                imageController.maskPenData.startLine(p);
                lastX = event.getX();
                lastY = event.getY();
                updateMask();
        }

    }
 
Example 23
Source Project: GMapsFX   Source File: GoogleMapView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Event dispatchEvent(Event event, EventDispatchChain tail) {

    if (event instanceof MouseEvent) {
        MouseEvent mouseEvent = (MouseEvent) event;
        if (mouseEvent.getClickCount() > 1) {
            if (disableDoubleClick) {
                mouseEvent.consume();
            }
        }
    }
    return originalDispatcher.dispatchEvent(event, tail);
}
 
Example 24
Source Project: chat-socket   Source File: FriendListWindow.java    License: MIT License 5 votes vote down vote up
@FXML
private void onListViewItemClick(MouseEvent event) {
    if (event.getClickCount() == 2) {
        Profile selectedItem = friendListView.getSelectionModel().getSelectedItem();
        if (friendButtonClickListener != null && selectedItem != null)
            friendButtonClickListener.call(selectedItem);
    }
}
 
Example 25
Source Project: chart-fx   Source File: Zoomer.java    License: Apache License 2.0 5 votes vote down vote up
private boolean isMouseEventWithinCanvas(final MouseEvent mouseEvent) {
    final Canvas canvas = getChart().getCanvas();
    // listen to only events within the canvas
    final Point2D mouseLoc = new Point2D(mouseEvent.getScreenX(), mouseEvent.getScreenY());
    final Bounds screenBounds = canvas.localToScreen(canvas.getBoundsInLocal());
    return screenBounds.contains(mouseLoc);
}
 
Example 26
Source Project: chart-fx   Source File: DragResizerUtil.java    License: Apache License 2.0 5 votes vote down vote up
protected void resetNodeSize(final MouseEvent evt) {
    if (!evt.isPrimaryButtonDown() || evt.getClickCount() < 2) {
        return;
    }

    if (!(node instanceof Region)) {
        return;
    }

    ((Region) node).setPrefWidth(Region.USE_COMPUTED_SIZE);
    ((Region) node).setPrefHeight(Region.USE_COMPUTED_SIZE);
}
 
Example 27
Source Project: MyBox   Source File: ImageMaskController.java    License: Apache License 2.0 5 votes vote down vote up
protected void doubleClickedCircle(MouseEvent event) {
    if (maskCircleLine == null || !maskCircleLine.isVisible()) {
        return;
    }
    DoublePoint p = getImageXY(event, imageView);
    if (p == null) {
        return;
    }
    double x = p.getX();
    double y = p.getY();
    if (event.getButton() == MouseButton.PRIMARY) {

        maskCircleData.setCenterX(x);
        maskCircleData.setCenterY(y);
        drawMaskCircleLine();

    } else if (event.getButton() == MouseButton.SECONDARY) {

        if (x != maskCircleData.getCenterX() || y != maskCircleData.getCenterY()) {
            double dx = x - maskCircleData.getCenterX();
            double dy = y - maskCircleData.getCenterY();
            maskCircleData.setRadius(Math.sqrt(dx * dx + dy * dy));
            drawMaskCircleLine();
        }

    }
}
 
Example 28
Source Project: tilesfx   Source File: SwitchSliderTileSkin.java    License: Apache License 2.0 5 votes vote down vote up
@Override protected void registerListeners() {
    super.registerListeners();
    thumb.addEventHandler(MouseEvent.MOUSE_PRESSED, mouseEventHandler);
    thumb.addEventHandler(MouseEvent.MOUSE_DRAGGED, mouseEventHandler);
    thumb.addEventHandler(MouseEvent.MOUSE_RELEASED, mouseEventHandler);

    switchBorder.addEventHandler(MouseEvent.MOUSE_PRESSED, mouseEventHandler);
    switchBorder.addEventHandler(MouseEvent.MOUSE_RELEASED, mouseEventHandler);

    tile.activeProperty().addListener(selectedListener);

    tile.valueProperty().addListener(valueListener);
}
 
Example 29
Source Project: logbook-kai   Source File: PopOver.java    License: MIT License 5 votes vote down vote up
/**
 * マウスがこのアンカーノードに入るときに呼び出される関数を定義します。
 *
 * @param event {@link MouseEvent}
 */
protected void setOnMouseEntered(MouseEvent event) {
    Node anchorNode = (Node) event.getSource();
    Popup popup = this.initPopup(anchorNode);
    Bounds screen = anchorNode.localToScreen(anchorNode.getLayoutBounds());
    popup.setAnchorLocation(PopupWindow.AnchorLocation.CONTENT_TOP_LEFT);
    popup.show(anchorNode.getScene().getWindow(), screen.getMinX(), screen.getMaxY());
    this.setLocation(popup, anchorNode, event);
}
 
Example 30
Source Project: openstock   Source File: ChartCanvas.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Handles a mouse released event by passing it on to the registered 
 * handlers.
 * 
 * @param e  the mouse event.
 */
private void handleMouseClicked(MouseEvent e) {
    if (this.liveHandler != null && this.liveHandler.isEnabled()) {
        this.liveHandler.handleMouseClicked(this, e);
    }

    // pass on the event to the auxiliary handlers
    for (MouseHandlerFX handler: this.auxiliaryMouseHandlers) {
        if (handler.isEnabled()) {
            handler.handleMouseClicked(this, e);
        }
    }
}