Example usage for javafx.scene.paint Color YELLOW

List of usage examples for javafx.scene.paint Color YELLOW

Introduction

In this page you can find the example usage for javafx.scene.paint Color YELLOW.

Prototype

Color YELLOW

To view the source code for javafx.scene.paint Color YELLOW.

Click Source Link

Document

The color yellow with an RGB value of #FFFF00

Usage

From source file:Jigs_Desktop_Client.GUI.FXMLDocumentController.java

private void connectToUser(String user_to_search) {
    if (user_to_search.equals(""))
        user_to_search = this.to_user;
    try {//ww  w  . java  2  s .c  om
        System.out.println("Searching for: " + user_to_search);
        if (jc.findUser(user_to_search)) {
            String to_user_status = "offline";
            this.to_user = user_to_search;
            for (UserStatus us : this.users_available) {
                if (us.getUsername().equalsIgnoreCase(user_to_search))
                    to_user_status = us.getStatus();
            }
            if (to_user_status.equals("online")) {
                this.connection_circle.setFill(Color.LIGHTGREEN);
                search_user_result.setText("Connected to @" + user_to_search);
                this.selected_user.setText("Connected to @" + user_to_search);
                try {
                    this.spin_earth_image.setImage(new Image(
                            getClass().getResource("resources/spin_earth_bright.gif").toURI().toString()));
                } catch (URISyntaxException ex) {
                    this.alert("resources/app_error.mp3");
                }
            } else {
                this.connection_circle.setFill(Color.YELLOW);
                search_user_result.setText("Offline messaging @" + user_to_search);
                this.selected_user.setText("Sending offline messages @" + user_to_search);
            }
            this.btn_send.setDisable(false);
            this.alert("resources/app_user_connected.mp3");
            main_tab_pane.getSelectionModel().select(2);
        } else {
            this.connection_circle.setFill(Color.RED);
            search_user_result.setText("No user found for @" + user_to_search);
            this.btn_send.setDisable(true);
            this.alert("resources/app_no_such_user.mp3");
        }
    } catch (IOException ex) {
        this.connection_circle.setFill(Color.RED);
        search_user_result.setText(ex.getMessage());
        this.btn_send.setDisable(true);
        this.alert("resources/app_error.mp3");
    }
}

From source file:Main.java

static Node displacementMap() {
    int w = 220;//ww w  .ja v  a 2s  .c o m
    int h = 100;
    FloatMap map = new FloatMap();
    map.setWidth(w);
    map.setHeight(h);

    for (int i = 0; i < w; i++) {
        double v = (Math.sin(i / 50.0 * Math.PI) - 0.5) / 40.0;
        for (int j = 0; j < h; j++) {
            map.setSamples(i, j, 0.0f, (float) v);
        }
    }

    Group g = new Group();
    DisplacementMap dm = new DisplacementMap();
    dm.setMapData(map);

    Rectangle r = new Rectangle();
    r.setX(20.0f);
    r.setY(20.0f);
    r.setWidth(w);
    r.setHeight(h);
    r.setFill(Color.BLUE);

    g.getChildren().add(r);

    Text t = new Text();
    t.setX(40.0f);
    t.setY(80.0f);
    t.setText("Wavy Text");
    t.setFill(Color.YELLOW);
    t.setFont(Font.font("null", FontWeight.BOLD, 36));

    g.getChildren().add(t);

    g.setEffect(dm);
    g.setCache(true);

    g.setTranslateX(400);
    g.setTranslateY(200);

    return g;
}

From source file:Main.java

static Node bloom() {
    Group g = new Group();

    Rectangle r = new Rectangle();
    r.setX(10);/* w  ww.  java2 s  .  c o m*/
    r.setY(10);
    r.setWidth(160);
    r.setHeight(80);
    r.setFill(Color.DARKBLUE);

    Text t = new Text();
    t.setText("Bloom!");
    t.setFill(Color.YELLOW);
    t.setFont(Font.font("null", FontWeight.BOLD, 36));
    t.setX(25);
    t.setY(65);

    g.setCache(true);
    //g.setEffect(new Bloom());
    Bloom bloom = new Bloom();
    bloom.setThreshold(1.0);
    g.setEffect(bloom);
    g.getChildren().add(r);
    g.getChildren().add(t);
    g.setTranslateX(350);
    return g;
}

From source file:de.pixida.logtest.designer.automaton.AutomatonEdge.java

AutomatonEdge(final Graph graph) {
    super(graph, Z_INDEX_AUTOMATON_EDGE_NODES);

    this.regExpPropertyNode = new PropertyNode(graph, this, "RegExp", Z_INDEX_AUTOMATON_EDGES_PROPERTIES,
            Z_INDEX_AUTOMATON_EDGES_CONNECTORS_TO_PROPERTIES);
    this.checkExpPropertyNode = new PropertyNode(graph, this, "Check Expression",
            Z_INDEX_AUTOMATON_EDGES_PROPERTIES, Z_INDEX_AUTOMATON_EDGES_CONNECTORS_TO_PROPERTIES);
    this.triggerOnEofPropertyNode = new PropertyNode(graph, this, "EOF", Z_INDEX_AUTOMATON_EDGES_PROPERTIES,
            Z_INDEX_AUTOMATON_EDGES_CONNECTORS_TO_PROPERTIES);
    this.onWalkPropertyNode = new PropertyNode(graph, this, "On Walk", Z_INDEX_AUTOMATON_EDGES_PROPERTIES,
            Z_INDEX_AUTOMATON_EDGES_CONNECTORS_TO_PROPERTIES);
    this.channelPropertyNode = new PropertyNode(graph, this, "Channel", Z_INDEX_AUTOMATON_EDGES_PROPERTIES,
            Z_INDEX_AUTOMATON_EDGES_CONNECTORS_TO_PROPERTIES);
    this.descriptionPropertyNode = new PropertyNode(graph, this, PropertyNode.WITHOUT_TITLE,
            Z_INDEX_AUTOMATON_EDGES_PROPERTIES, Z_INDEX_AUTOMATON_EDGES_CONNECTORS_TO_PROPERTIES);
    this.descriptionPropertyNode
            .setColor(Color.YELLOW.desaturate().desaturate().desaturate().brighter().brighter());
    this.timingConditionsPropertyNode = new PropertyNode(graph, this, "Timing Conditions",
            Z_INDEX_AUTOMATON_EDGES_PROPERTIES, Z_INDEX_AUTOMATON_EDGES_CONNECTORS_TO_PROPERTIES);
}

From source file:com.github.vatbub.tictactoe.view.Main.java

private void showWinnerWithTwoHumanPlayers(Board.WinnerInfo winnerInfo) {
    guiAnimationQueue.submitWaitForUnlock(() -> addWinLineOnWin(winnerInfo, Color.YELLOW, () -> {
        twoHumansWinnerText.setText(winnerInfo.winningPlayer.getName() + " won :)");
        double endX = twoHumansWinnerImage.getX();
        double endY = twoHumansWinnerImage.getY();

        AnchorPane.clearConstraints(twoHumansWinnerImage);
        twoHumansWinnerImage.setX(endX);
        twoHumansWinnerImage.setY(twoHumansWinnerImage.getY() + 300);

        // blurGamePane();
        blurGamePane(10.0);//ww  w  .j  a  v a 2 s  .com
        twoHumansWinMessage.setOpacity(0);
        twoHumansWinnerImage.setOpacity(0);
        twoHumansWinnerPane.setOpacity(1);
        twoHumansWinnerPane.setVisible(true);
        twoHumansWinnerImage.setVisible(true);

        Timeline timeline = new Timeline();
        double S4 = 1.45;
        double x0 = 0.33;

        KeyValue twoHumansWinnerImageKeyValue1x = new KeyValue(twoHumansWinnerImage.xProperty(), endX,
                new CustomEaseOutInterpolator(S4, x0));
        KeyValue twoHumansWinnerImageKeyValue1y = new KeyValue(twoHumansWinnerImage.yProperty(), endY,
                new CustomEaseOutInterpolator(S4, x0));
        KeyValue twoHumansWinnerImageKeyValue1Opacity = new KeyValue(twoHumansWinnerImage.opacityProperty(), 1);
        KeyFrame twoHumansWinnerImageKeyFrame1 = new KeyFrame(Duration.millis(600),
                twoHumansWinnerImageKeyValue1x, twoHumansWinnerImageKeyValue1y,
                twoHumansWinnerImageKeyValue1Opacity);
        timeline.getKeyFrames().addAll(twoHumansWinnerImageKeyFrame1);

        timeline.setOnFinished((event) -> fadeNode(twoHumansWinMessage, 1, () -> {
            AnchorPane.setLeftAnchor(twoHumansWinnerImage, 0.0);
            AnchorPane.setBottomAnchor(twoHumansWinnerImage, 0.0);
        }));

        timeline.play();
    }));
}

From source file:editeurpanovisu.EditeurPanovisu.java

private ScrollPane afficheLegende() {
    double positionX = 0;
    double positionY = 0;
    AnchorPane apLegende = new AnchorPane();
    ScrollPane spLegende = new ScrollPane(apLegende);
    spLegende.getStyleClass().add("legendePane");

    apLegende.setMinWidth(1000);/*from w w w.  j  a  v a 2s  .  c om*/
    apLegende.setMinHeight(150);
    apLegende.setPrefWidth(1000);
    apLegende.setPrefHeight(150);
    apLegende.setMaxWidth(1000);
    apLegende.setMaxHeight(150);
    positionY = (pano.getLayoutY() + pano.getPrefHeight() + 10);

    Circle point = new Circle(30, 20, 5);
    point.setFill(Color.YELLOW);
    point.setStroke(Color.RED);
    point.setCursor(Cursor.DEFAULT);
    Circle point2 = new Circle(30, 60, 5);
    point2.setFill(Color.BLUE);
    point2.setStroke(Color.YELLOW);
    point2.setCursor(Cursor.DEFAULT);
    Circle point3 = new Circle(30, 100, 5);
    point3.setFill(Color.GREEN);
    point3.setStroke(Color.YELLOW);
    point3.setCursor(Cursor.DEFAULT);
    Polygon polygon = new Polygon();
    polygon.getPoints().addAll(new Double[] { 15.0, 2.0, 2.0, 2.0, 2.0, 15.0, -2.0, 15.0, -2.0, 2.0, -15.0, 2.0,
            -15.0, -2.0, -2.0, -2.0, -2.0, -15.0, 2.0, -15.0, 2.0, -2.0, 15.0, -2.0 });
    polygon.setStrokeLineJoin(StrokeLineJoin.MITER);
    polygon.setFill(Color.BLUEVIOLET);
    polygon.setStroke(Color.YELLOW);
    polygon.setId("PoV");
    polygon.setLayoutX(500);
    polygon.setLayoutY(20);
    Label lblHS = new Label(rb.getString("main.legendeHS"));
    Label lblHSImage = new Label(rb.getString("main.legendeHSImage"));
    //Label lblHSHTML = new Label(rb.getString("main.legendeHSHTML"));
    Label lblPoV = new Label(rb.getString("main.legendePoV"));
    Label lblNord = new Label(rb.getString("main.legendeNord"));
    Line ligneNord = new Line(500, 45, 500, 65);
    ligneNord.setStroke(Color.RED);
    ligneNord.setStrokeWidth(3);
    lblHS.setLayoutX(50);
    lblHS.setLayoutY(10);
    lblHSImage.setLayoutX(50);
    lblHSImage.setLayoutY(50);
    //lblHSHTML.setLayoutX(50);
    //lblHSHTML.setLayoutY(90);
    lblPoV.setLayoutX(520);
    lblPoV.setLayoutY(10);
    lblNord.setLayoutX(520);
    lblNord.setLayoutY(50);
    //        apLegende.getChildren().addAll(lblHS, point, lblHSImage, point2, lblHSHTML, point3, lblPoV, polygon, lblNord, ligneNord);
    apLegende.getChildren().addAll(lblHS, point, lblHSImage, point2, lblPoV, polygon, lblNord, ligneNord);
    apLegende.setId("legende");
    apLegende.setVisible(true);
    if (largeurMax - 50 < 1004) {
        spLegende.setPrefWidth(largeurMax - 50);
        spLegende.setMaxWidth(largeurMax - 50);
        positionX = 25;
    } else {
        spLegende.setPrefWidth(1004);
        spLegende.setMaxWidth(1004);
        positionX = (largeurMax - 1004) / 2.d;
    }
    spLegende.setLayoutX(positionX);
    spLegende.setLayoutY(positionY);
    spLegende.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    spLegende.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);

    return spLegende;
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param i/*from  w w w .java 2s  .c  o m*/
 * @param longitude
 * @param latitude
 */
private void afficheHS(int i, double longitude, double latitude) {
    double largeur = imagePanoramique.getFitWidth();
    double X = (longitude + 180.0d) * largeur / 360.0d + imagePanoramique.getLayoutX();
    double Y = (90.0d - latitude) * largeur / 360.0d;
    Circle point = new Circle(X, Y, 5);
    point.setFill(Color.YELLOW);
    point.setStroke(Color.RED);
    point.setId("point" + i);
    point.setCursor(Cursor.DEFAULT);
    pano.getChildren().add(point);

    Tooltip t = new Tooltip("point n " + (i + 1));
    t.setStyle(tooltipStyle);
    Tooltip.install(point, t);
    point.setOnDragDetected((MouseEvent me1) -> {
        point.setFill(Color.RED);
        point.setStroke(Color.YELLOW);
        dragDrop = true;
        me1.consume();

    });
    point.setOnMouseDragged((MouseEvent me1) -> {
        double XX = me1.getX() - imagePanoramique.getLayoutX();
        if (XX < 0) {
            XX = 0;
        }
        if (XX > imagePanoramique.getFitWidth()) {
            XX = imagePanoramique.getFitWidth();
        }
        point.setCenterX(XX + imagePanoramique.getLayoutX());
        double YY = me1.getY();
        if (YY < 0) {
            YY = 0;
        }
        if (YY > imagePanoramique.getFitHeight()) {
            YY = imagePanoramique.getFitHeight();
        }
        point.setCenterY(YY);
        me1.consume();

    });
    point.setOnMouseReleased((MouseEvent me1) -> {
        String chPoint = point.getId();
        chPoint = chPoint.substring(5, chPoint.length());
        int numeroPoint = Integer.parseInt(chPoint);
        double X1 = me1.getSceneX();
        double Y1 = me1.getSceneY();
        double mouseX = X1 - imagePanoramique.getLayoutX();
        if (mouseX < 0) {
            mouseX = 0;
        }
        if (mouseX > imagePanoramique.getFitWidth()) {
            mouseX = imagePanoramique.getFitWidth();
        }

        double mouseY = Y1 - pano.getLayoutY() - 109;
        if (mouseY < 0) {
            mouseY = 0;
        }
        if (mouseY > imagePanoramique.getFitHeight()) {
            mouseY = imagePanoramique.getFitHeight();
        }

        double longit, lat;
        double larg = imagePanoramique.getFitWidth();
        String chLong, chLat;
        longit = 360.0f * mouseX / larg - 180;
        lat = 90.0d - 2.0f * mouseY / larg * 180.0f;
        panoramiquesProjet[panoActuel].getHotspot(numeroPoint).setLatitude(lat);
        panoramiquesProjet[panoActuel].getHotspot(numeroPoint).setLongitude(longit);
        point.setFill(Color.YELLOW);
        point.setStroke(Color.RED);
        me1.consume();

    });

    point.setOnMouseClicked((MouseEvent me1) -> {
        double mouseX = me1.getSceneX() - imagePanoramique.getLayoutX();
        if (mouseX < 0) {
            mouseX = 0;
        }
        if (mouseX > imagePanoramique.getFitWidth()) {
            mouseX = imagePanoramique.getFitWidth();
        }

        double mouseY = me1.getSceneY() - pano.getLayoutY() - 115;
        if (mouseY < 0) {
            mouseY = 0;
        }
        if (mouseY > imagePanoramique.getFitHeight()) {
            mouseY = imagePanoramique.getFitHeight();
        }

        String chPoint = point.getId();
        chPoint = chPoint.substring(5, chPoint.length());
        int numeroPoint = Integer.parseInt(chPoint);
        Node pt;
        pt = (Node) pano.lookup("#point" + chPoint);

        if (me1.isControlDown()) {
            dejaSauve = false;
            stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *");
            pano.getChildren().remove(pt);

            for (int o = numeroPoint + 1; o < numPoints; o++) {
                pt = (Node) pano.lookup("#point" + Integer.toString(o));
                pt.setId("point" + Integer.toString(o - 1));
            }
            /**
             * on retire les anciennes indication de HS
             */
            retireAffichageHotSpots();
            numPoints--;
            panoramiquesProjet[panoActuel].removeHotspot(numeroPoint);
            /**
             * On les cre les nouvelles
             */
            ajouteAffichageHotspots();
            me1.consume();
            valideHS();
        } else {
            if (!dragDrop) {
                if (nombrePanoramiques > 1) {
                    AnchorPane listePanoVig = afficherListePanosVignettes(numeroPoint);
                    int largeurVignettes = 4;
                    if (nombrePanoramiques < 4) {
                        largeurVignettes = nombrePanoramiques;
                    }
                    if (mouseX + largeurVignettes * 130 > pano.getWidth()) {
                        listePanoVig.setLayoutX(pano.getWidth() - largeurVignettes * 130);
                    } else {
                        listePanoVig.setLayoutX(mouseX);
                    }
                    listePanoVig.setLayoutY(mouseY);
                    pano.getChildren().add(listePanoVig);
                }
            } else {
                dragDrop = false;
            }
            valideHS();
            me1.consume();

        }

    });
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param i//w w  w . j a  v a  2s.  c  om
 * @param longitude
 * @param latitude
 */
private void afficheHSImage(int i, double longitude, double latitude) {
    double largeur = imagePanoramique.getFitWidth();
    double X = (longitude + 180.0d) * largeur / 360.0d + imagePanoramique.getLayoutX();
    double Y = (90.0d - latitude) * largeur / 360.0d;
    Circle point = new Circle(X, Y, 5);
    point.setFill(Color.BLUE);
    point.setStroke(Color.YELLOW);
    point.setId("img" + i);
    point.setCursor(Cursor.DEFAULT);
    pano.getChildren().add(point);
    Tooltip t = new Tooltip("image n " + (i + 1));
    t.setStyle(tooltipStyle);
    Tooltip.install(point, t);
    point.setOnDragDetected((MouseEvent me1) -> {
        point.setFill(Color.YELLOW);
        point.setStroke(Color.BLUE);
        dragDrop = true;
        me1.consume();

    });
    point.setOnMouseDragged((MouseEvent me1) -> {
        double XX = me1.getX() - imagePanoramique.getLayoutX();
        if (XX < 0) {
            XX = 0;
        }
        if (XX > imagePanoramique.getFitWidth()) {
            XX = imagePanoramique.getFitWidth();
        }
        point.setCenterX(XX + imagePanoramique.getLayoutX());
        double YY = me1.getY();
        if (YY < 0) {
            YY = 0;
        }
        if (YY > imagePanoramique.getFitHeight()) {
            YY = imagePanoramique.getFitHeight();
        }
        point.setCenterY(YY);

        me1.consume();

    });
    point.setOnMouseReleased((MouseEvent me1) -> {
        String chPoint = point.getId();
        chPoint = chPoint.substring(3, chPoint.length());
        int numeroPoint = Integer.parseInt(chPoint);
        double X1 = me1.getSceneX();
        double Y1 = me1.getSceneY();
        double mouseX = X1 - imagePanoramique.getLayoutX();
        if (mouseX < 0) {
            mouseX = 0;
        }
        if (mouseX > imagePanoramique.getFitWidth()) {
            mouseX = imagePanoramique.getFitWidth();
        }
        double mouseY = Y1 - pano.getLayoutY() - 109;
        if (mouseY < 0) {
            mouseY = 0;
        }
        if (mouseY > imagePanoramique.getFitHeight()) {
            mouseY = imagePanoramique.getFitHeight();
        }

        double longit, lat;
        double larg = imagePanoramique.getFitWidth();
        String chLong, chLat;
        longit = 360.0f * mouseX / larg - 180;
        lat = 90.0d - 2.0f * mouseY / larg * 180.0f;
        panoramiquesProjet[panoActuel].getHotspotImage(numeroPoint).setLatitude(lat);
        panoramiquesProjet[panoActuel].getHotspotImage(numeroPoint).setLongitude(longit);
        point.setFill(Color.BLUE);
        point.setStroke(Color.YELLOW);
        me1.consume();

    });

    point.setOnMouseClicked((MouseEvent me1) -> {
        String chPoint = point.getId();
        chPoint = chPoint.substring(3, chPoint.length());
        int numeroPoint = Integer.parseInt(chPoint);
        Node pt;
        pt = (Node) pano.lookup("#img" + chPoint);

        if (me1.isControlDown()) {
            valideHS();
            dejaSauve = false;
            stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *");
            pano.getChildren().remove(pt);

            for (int o = numeroPoint + 1; o < numImages; o++) {
                pt = (Node) pano.lookup("#img" + Integer.toString(o));
                pt.setId("img" + Integer.toString(o - 1));
            }
            /**
             * on retire les anciennes indication de HS
             */
            retireAffichageHotSpots();
            numImages--;
            panoramiquesProjet[panoActuel].removeHotspotImage(numeroPoint);
            /**
             * On les cre les nouvelles
             */
            ajouteAffichageHotspots();
            me1.consume();
        } else {
            me1.consume();
        }

    });
}

From source file:editeurpanovisu.EditeurPanovisu.java

private void affichePoV(double longitude, double latitude) {
    double largeur = imagePanoramique.getFitWidth();
    double X = (longitude + 180.0d) * largeur / 360.0d + imagePanoramique.getLayoutX();
    double Y = (90.0d - latitude) * largeur / 360.0d;
    Node ancPoV = (Node) pano.lookup("#PoV");
    if (ancPoV != null) {
        pano.getChildren().remove(ancPoV);
    }//  w w  w  . j  av  a 2s.com
    Polygon polygon = new Polygon();
    polygon.getPoints().addAll(new Double[] { 20.0, 2.0, 2.0, 2.0, 2.0, 20.0, -2.0, 20.0, -2.0, 2.0, -20.0, 2.0,
            -20.0, -2.0, -2.0, -2.0, -2.0, -20.0, 2.0, -20.0, 2.0, -2.0, 20.0, -2.0 });
    polygon.setStrokeLineJoin(StrokeLineJoin.MITER);
    polygon.setFill(Color.BLUEVIOLET);
    polygon.setStroke(Color.YELLOW);
    polygon.setId("PoV");
    polygon.setLayoutX(X);
    polygon.setLayoutY(Y);
    polygon.setCursor(Cursor.DEFAULT);
    polygon.setOnDragDetected((MouseEvent me1) -> {
        polygon.setFill(Color.YELLOW);
        polygon.setStroke(Color.BLUEVIOLET);
        dragDrop = true;
        me1.consume();

    });
    polygon.setOnMouseDragged((MouseEvent me1) -> {

        double XX = me1.getSceneX() - imagePanoramique.getLayoutX();
        if (XX < 0) {
            XX = 0;
        }
        if (XX > imagePanoramique.getFitWidth()) {
            XX = imagePanoramique.getFitWidth();
        }
        polygon.setLayoutX(XX + imagePanoramique.getLayoutX());
        double YY = me1.getSceneY() - pano.getLayoutY() - 109;
        if (YY < 0) {
            YY = 0;
        }
        if (YY > imagePanoramique.getFitHeight()) {
            YY = imagePanoramique.getFitHeight();
        }
        polygon.setLayoutY(YY);

        me1.consume();

    });
    polygon.setOnMouseReleased((MouseEvent me1) -> {
        double X1 = me1.getSceneX();
        double Y1 = me1.getSceneY();
        double mouseX1 = X1 - imagePanoramique.getLayoutX();
        if (mouseX1 < 0) {
            mouseX1 = 0;
        }
        if (mouseX1 > imagePanoramique.getFitWidth()) {
            mouseX1 = imagePanoramique.getFitWidth();
        }
        double mouseY1 = Y1 - pano.getLayoutY() - 109;
        if (mouseY1 < 0) {
            mouseY1 = 0;
        }
        if (mouseY1 > imagePanoramique.getFitHeight()) {
            mouseY1 = imagePanoramique.getFitHeight();
        }
        double regardX = 360.0f * mouseX1 / largeur - 180;
        double regardY = 90.0d - 2.0f * mouseY1 / largeur * 180.0f;
        panoramiquesProjet[panoActuel].setLookAtX(regardX);
        panoramiquesProjet[panoActuel].setLookAtY(regardY);
        polygon.setFill(Color.BLUEVIOLET);
        polygon.setStroke(Color.YELLOW);
        me1.consume();

    });

    pano.getChildren().add(polygon);
}

From source file:editeurpanovisu.EditeurPanovisu.java

private void panoMouseClic(double X, double Y) {

    if (nombrePanoramiques > 1) {
        valideHS();/*from   www.  j a  va2  s. c  o m*/
        dejaSauve = false;
        stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *");
        double mouseX = X;
        double mouseY = Y - pano.getLayoutY() - 109;
        if (X > 0 && X < imagePanoramique.getFitWidth()) {
            double longitude, latitude;
            double largeur = imagePanoramique.getFitWidth();
            String chLong, chLat;
            longitude = 360.0f * mouseX / largeur - 180;
            latitude = 90.0d - 2.0f * mouseY / largeur * 180.0f;
            Circle point = new Circle(mouseX + imagePanoramique.getLayoutX(), mouseY, 5);
            point.setFill(Color.YELLOW);
            point.setStroke(Color.RED);
            point.setId("point" + numPoints);
            point.setCursor(Cursor.DEFAULT);
            pano.getChildren().add(point);
            Tooltip t = new Tooltip("point n" + (numPoints + 1));
            t.setStyle(tooltipStyle);
            Tooltip.install(point, t);
            HotSpot HS = new HotSpot();
            HS.setLongitude(longitude);
            HS.setLatitude(latitude);
            panoramiquesProjet[panoActuel].addHotspot(HS);
            retireAffichageHotSpots();
            Pane affHS1 = affichageHS(listePano(panoActuel), panoActuel);
            affHS1.setId("labels");
            outils.getChildren().add(affHS1);

            numPoints++;
            if (nombrePanoramiques > 1) {

                AnchorPane listePanoVig = afficherListePanosVignettes(
                        panoramiquesProjet[panoActuel].getNombreHotspots() - 1);
                int largeurVignettes = 4;
                if (nombrePanoramiques < 4) {
                    largeurVignettes = nombrePanoramiques;
                }
                if (mouseX + largeurVignettes * 130 > pano.getWidth()) {
                    listePanoVig.setLayoutX(pano.getWidth() - largeurVignettes * 130);
                } else {
                    listePanoVig.setLayoutX(mouseX);
                }
                listePanoVig.setLayoutY(mouseY);
                pano.getChildren().add(listePanoVig);
                valideHS();
            }
            point.setOnDragDetected((MouseEvent me1) -> {
                String chPoint = point.getId();
                chPoint = chPoint.substring(5, chPoint.length());
                int numeroPoint = Integer.parseInt(chPoint);
                Node pt;
                pt = (Node) pano.lookup("#point" + chPoint);
                point.setFill(Color.RED);
                point.setStroke(Color.YELLOW);
                dragDrop = true;
                me1.consume();

            });
            point.setOnMouseDragged((MouseEvent me1) -> {
                double XX = me1.getX() - imagePanoramique.getLayoutX();
                if (XX < 0) {
                    XX = 0;
                }
                if (XX > imagePanoramique.getFitWidth()) {
                    XX = imagePanoramique.getFitWidth();
                }
                point.setCenterX(XX + imagePanoramique.getLayoutX());
                double YY = me1.getY();
                if (YY < 0) {
                    YY = 0;
                }
                if (YY > imagePanoramique.getFitHeight()) {
                    YY = imagePanoramique.getFitHeight();
                }
                point.setCenterY(YY);

                me1.consume();

            });
            point.setOnMouseReleased((MouseEvent me1) -> {
                String chPoint = point.getId();
                chPoint = chPoint.substring(5, chPoint.length());
                int numeroPoint = Integer.parseInt(chPoint);
                double X1 = me1.getSceneX();
                double Y1 = me1.getSceneY();
                double mouseX1 = X1 - imagePanoramique.getLayoutX();
                if (mouseX1 < 0) {
                    mouseX1 = 0;
                }
                if (mouseX1 > imagePanoramique.getFitWidth()) {
                    mouseX1 = imagePanoramique.getFitWidth();
                }
                double mouseY1 = Y1 - pano.getLayoutY() - 109;
                if (mouseY1 < 0) {
                    mouseY1 = 0;
                }
                if (mouseY1 > imagePanoramique.getFitHeight()) {
                    mouseY1 = imagePanoramique.getFitHeight();
                }
                double longit, lat;
                double larg = imagePanoramique.getFitWidth();
                longit = 360.0f * mouseX1 / larg - 180;
                lat = 90.0d - 2.0f * mouseY1 / larg * 180.0f;
                panoramiquesProjet[panoActuel].getHotspot(numeroPoint).setLatitude(lat);
                panoramiquesProjet[panoActuel].getHotspot(numeroPoint).setLongitude(longit);
                point.setFill(Color.YELLOW);
                point.setStroke(Color.RED);
                me1.consume();

            });

            point.setOnMouseClicked((MouseEvent me1) -> {
                if (me1.isControlDown()) {
                    dejaSauve = false;
                    stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *");
                    String chPoint = point.getId();
                    chPoint = chPoint.substring(5, chPoint.length());
                    int numeroPoint = Integer.parseInt(chPoint);
                    Node pt;
                    pt = (Node) pano.lookup("#point" + chPoint);
                    pano.getChildren().remove(pt);

                    for (int o = numeroPoint + 1; o < numPoints; o++) {
                        pt = (Node) pano.lookup("#point" + Integer.toString(o));
                        pt.setId("point" + Integer.toString(o - 1));
                    }
                    /**
                     * on retire les anciennes indication de HS
                     */
                    retireAffichageHotSpots();
                    numPoints--;
                    panoramiquesProjet[panoActuel].removeHotspot(numeroPoint);
                    /**
                     * On les cre les nouvelles
                     */
                    ajouteAffichageHotspots();
                    valideHS();
                    me1.consume();
                } else {
                    if (!dragDrop) {
                        String chPoint = point.getId();
                        chPoint = chPoint.substring(5, chPoint.length());
                        int numeroPoint = Integer.parseInt(chPoint);
                        if (nombrePanoramiques > 1) {
                            AnchorPane listePanoVig = afficherListePanosVignettes(numeroPoint);
                            int largeurVignettes = 4;
                            if (nombrePanoramiques < 4) {
                                largeurVignettes = nombrePanoramiques;
                            }
                            if (mouseX + largeurVignettes * 130 > pano.getWidth()) {
                                listePanoVig.setLayoutX(pano.getWidth() - largeurVignettes * 130);
                            } else {
                                listePanoVig.setLayoutX(mouseX);
                            }
                            listePanoVig.setLayoutY(mouseY);
                            pano.getChildren().add(listePanoVig);
                        }
                    } else {
                        dragDrop = false;
                    }
                    valideHS();
                    me1.consume();

                }
            });
        }
    }
}