Example usage for javafx.scene.control ListView setCursor

List of usage examples for javafx.scene.control ListView setCursor

Introduction

In this page you can find the example usage for javafx.scene.control ListView setCursor.

Prototype

public final void setCursor(Cursor value) 

Source Link

Usage

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param mouseEvent/* www  .j  a va  2 s .com*/
 */
private static void gereSourisPanoramique(MouseEvent mouseEvent) {
    if (mouseEvent.getButton() == MouseButton.SECONDARY) {
        if (mouseEvent.isShiftDown()) {
            panoChoixNord(mouseEvent.getSceneX() - ivImagePanoramique.getLayoutX());
            mouseEvent.consume();
        } else if (mouseEvent.isControlDown()) {
        } else {
            panoChoixRegard(mouseEvent.getSceneX() - ivImagePanoramique.getLayoutX(),
                    mouseEvent.getSceneY() - getiDecalageMac());
            mouseEvent.consume();
        }
    }
    if (mouseEvent.getButton() == MouseButton.PRIMARY) {
        if (!(mouseEvent.isControlDown()) && bEstCharge) {
            if (!bDragDrop) {
                panePanoramique.setCursor(Cursor.DEFAULT);
                panePanoramique.setOnMouseClicked((me) -> {
                });
                Circle c1 = new Circle(mouseEvent.getSceneX(),
                        mouseEvent.getSceneY() - panePanoramique.getLayoutY() - 130 - getiDecalageMac(), 3);
                panePanoramique.getChildren().add(c1);
                ListView<String> lvMenuChoixTypeHotspot = new ListView<>();
                double tailleFenetre = 70;
                if (getiNombrePanoramiques() > 1) {
                    lvMenuChoixTypeHotspot.getItems().add("Panoramique");
                    tailleFenetre += 20;
                }
                lvMenuChoixTypeHotspot.getItems().add("Image");
                if (getiNombreDiapo() > 0) {
                    lvMenuChoixTypeHotspot.getItems().add("Diaporama");
                    tailleFenetre += 20;
                }
                lvMenuChoixTypeHotspot.getItems().add("HTML");
                lvMenuChoixTypeHotspot.getItems().add("Annuler");
                lvMenuChoixTypeHotspot.setMaxHeight(tailleFenetre);
                lvMenuChoixTypeHotspot.setPrefHeight(tailleFenetre);
                lvMenuChoixTypeHotspot.setMinHeight(tailleFenetre);
                lvMenuChoixTypeHotspot.setPrefWidth(120);
                lvMenuChoixTypeHotspot.setCursor(Cursor.DEFAULT);
                lvMenuChoixTypeHotspot.setLayoutX(mouseEvent.getSceneX());
                lvMenuChoixTypeHotspot.setLayoutY(
                        mouseEvent.getSceneY() - panePanoramique.getLayoutY() - 104 - getiDecalageMac());
                panePanoramique.getChildren().add(lvMenuChoixTypeHotspot);
                lvMenuChoixTypeHotspot.getSelectionModel().selectedItemProperty()
                        .addListener((ov, ancValeur, nouvValeur) -> {
                            panePanoramique.getChildren().remove(lvMenuChoixTypeHotspot);
                            panePanoramique.getChildren().remove(c1);

                            switch (nouvValeur) {
                            case "Panoramique":
                                panoMouseClic(mouseEvent.getSceneX() - ivImagePanoramique.getLayoutX(),
                                        mouseEvent.getSceneY());
                                break;
                            case "Image":
                                panoAjouteImage(mouseEvent.getSceneX() - ivImagePanoramique.getLayoutX(),
                                        mouseEvent.getSceneY());
                                break;
                            case "HTML":
                                panoAjouteHTML(mouseEvent.getSceneX() - ivImagePanoramique.getLayoutX(),
                                        mouseEvent.getSceneY());
                                break;
                            case "Diaporama":
                                panoAjouteDiaporama(mouseEvent.getSceneX() - ivImagePanoramique.getLayoutX(),
                                        mouseEvent.getSceneY());
                                break;
                            case "Annuler":
                                break;

                            }
                            panePanoramique.setCursor(Cursor.CROSSHAIR);
                            panePanoramique.setOnMouseClicked((me) -> {
                                gereSourisPanoramique(me);
                            });

                        });

            } else {
                bDragDrop = false;
            }
        }
    }
}