Example usage for javafx.scene.paint Color BLUE

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

Introduction

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

Prototype

Color BLUE

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

Click Source Link

Document

The color blue with an RGB value of #0000FF

Usage

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

private void updateRect() {
    String title = "";
    if (this.type == Type.INITIAL) {
        this.setColor(Color.BLUE.desaturate().desaturate().desaturate().desaturate().brighter().brighter());
        title += "INITIAL ";
    } else if (this.type == Type.SUCCESS) {
        this.setColor(Color.GREEN.desaturate().desaturate().desaturate().desaturate().brighter().brighter());
        title += "SUCCESS ";
    } else if (this.type == Type.FAILURE) {
        this.setColor(Color.RED.desaturate().desaturate().desaturate().desaturate().brighter().brighter());
        title += "FAILURE ";
    } else {/*from  w w w  .  j av  a 2  s  .c o m*/
        this.setColor(Color.LIGHTGREY);
    }
    title += "State";
    if (this.wait) {
        title += " | wait!";
    }
    this.setTitle(title);
}

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   www.  j  a v  a2 s.  co m
    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//w w  w  .ja v a  2  s. c o  m
 * @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 panoAjouteImage(double X, double Y) {
    if (X > 0 && X < imagePanoramique.getFitWidth()) {

        valideHS();/*  www .  j ava  2s.  co  m*/
        dejaSauve = false;
        stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *");
        double mouseX = X;
        double mouseY = Y - pano.getLayoutY() - 115;
        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, mouseY, 5);
        point.setFill(Color.BLUE);
        point.setStroke(Color.YELLOW);
        point.setId("img" + numImages);
        point.setCursor(Cursor.DEFAULT);
        pano.getChildren().add(point);
        Tooltip t = new Tooltip("image n " + (numImages + 1));
        t.setStyle(tooltipStyle);
        Tooltip.install(point, t);

        //
        File repert;
        if (repertHSImages.equals("")) {
            repert = new File(currentDir + File.separator);
        } else {
            repert = new File(repertHSImages);
        }
        FileChooser fileChooser = new FileChooser();
        FileChooser.ExtensionFilter extFilterImages = new FileChooser.ExtensionFilter(
                "Fichiers Images (jpg, bmp, png)", "*.jpg", "*.bmp", "*.png");

        fileChooser.setInitialDirectory(repert);
        fileChooser.getExtensionFilters().addAll(extFilterImages);

        File fichierImage = fileChooser.showOpenDialog(null);
        if (fichierImage != null) {
            repertHSImages = fichierImage.getParent();
            numImages++;
            HotspotImage HS = new HotspotImage();
            HS.setLongitude(longitude);
            HS.setLatitude(latitude);
            HS.setUrlImage(fichierImage.getAbsolutePath());
            HS.setLienImg(fichierImage.getName());
            HS.setInfo(fichierImage.getName().split("\\.")[0]);
            File repertImage = new File(repertTemp + File.separator + "images");
            if (!repertImage.exists()) {
                repertImage.mkdirs();
            }
            try {
                copieFichierRepertoire(fichierImage.getAbsolutePath(), repertImage.getAbsolutePath());
            } catch (IOException ex) {
                Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
            }
            panoramiquesProjet[panoActuel].addHotspotImage(HS);
            retireAffichageHotSpots();
            Pane affHS1 = affichageHS(listePano(panoActuel), panoActuel);
            affHS1.setId("labels");
            outils.getChildren().add(affHS1);

        } else {
            String chPoint = point.getId();
            chPoint = chPoint.substring(3, chPoint.length());
            Node pt = (Node) pano.lookup("#img" + chPoint);
            pano.getChildren().remove(pt);
        }
        valideHS();
        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 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].getHotspotImage(numeroPoint).setLatitude(lat);
            panoramiquesProjet[panoActuel].getHotspotImage(numeroPoint).setLongitude(longit);
            point.setFill(Color.BLUE);
            point.setStroke(Color.YELLOW);
            me1.consume();

        });

        point.setOnMouseClicked((MouseEvent me1) -> {
            if (me1.isControlDown()) {
                dejaSauve = false;
                stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *");
                String chPoint = point.getId();
                chPoint = chPoint.substring(3, chPoint.length());
                int numeroPoint = Integer.parseInt(chPoint);
                Node pt;
                pt = (Node) pano.lookup("#img" + chPoint);
                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();
            }
            valideHS();
            me1.consume();
        });

    }
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param strLstPano//from www.j a  va 2s.  c om
 * @param iNumPano
 * @return
 */
public static Pane paneAffichageHS(String strLstPano, int iNumPano) {

    Pane paneHotSpots = new Pane();
    paneHotSpots.setTranslateY(10);
    paneHotSpots.setTranslateX(10);
    VBox vbHotspots = new VBox(5);
    paneHotSpots.getChildren().add(vbHotspots);
    Label lblPoint;
    int io;
    for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspots(); io++) {
        Label lblSep = new Label(" ");
        Label lblSep1 = new Label(" ");
        VBox vbPanneauHS = new VBox();
        double deplacement = 0;
        vbPanneauHS.setLayoutX(deplacement);
        Pane paneHsPanoramique = new Pane(vbPanneauHS);
        paneHsPanoramique.setPrefHeight(300);
        paneHsPanoramique.setMinHeight(300);
        paneHsPanoramique.setMaxHeight(300);

        int iNum1 = io;
        Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#point" + iNum1);
            if (c1 != null) {
                if (c1.getFill() == Color.RED) {
                    c1.setFill(Color.YELLOW);
                    c1.setStroke(Color.RED);
                } else {
                    c1.setFill(Color.RED);
                    c1.setStroke(Color.YELLOW);
                }
            }
        }));
        timBouge.setCycleCount(Timeline.INDEFINITE);
        timBouge.pause();
        paneHsPanoramique.setOnMouseEntered((e) -> {
            timBouge.play();
        });
        paneHsPanoramique.setOnMouseExited((e) -> {
            timBouge.pause();
            Circle c1 = (Circle) panePanoramique.lookup("#point" + iNum1);
            if (c1 != null) {
                c1.setFill(Color.YELLOW);
                c1.setStroke(Color.RED);
            }
        });
        paneHsPanoramique
                .setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;");
        paneHsPanoramique.setId("HS" + io);
        lblPoint = new Label("Point #" + (io + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.setTranslateX(-deplacement);
        lblPoint.getStyleClass().add("titreOutil");
        Separator sepHotspots = new Separator(Orientation.HORIZONTAL);
        sepHotspots.setTranslateX(-deplacement);
        sepHotspots.setPrefWidth(321);
        sepHotspots.setTranslateX(2);
        paneHsPanoramique.setPrefWidth(325);
        vbPanneauHS.getChildren().addAll(lblPoint, sepHotspots);
        if (strLstPano != null) {

            Label lblLien = new Label(rbLocalisation.getString("main.panoramiqueDestination"));
            lblLien.setTranslateX(10);
            ComboBox cbDestPano = new ComboBox();
            String[] strListe = strLstPano.split(";");
            cbDestPano.getItems().addAll(Arrays.asList(strListe));
            int iNum11 = getPanoramiquesProjet()[iNumPano].getHotspot(io).getNumeroPano();
            cbDestPano.setTranslateX(10);
            cbDestPano.setId("cbpano" + io);
            cbDestPano.getSelectionModel().select(iNum11);
            cbDestPano.getSelectionModel().selectedIndexProperty().addListener((ov, t, t1) -> {
                valideHS();
                if (dejaCharge) {
                    dejaCharge = false;
                    retireAffichageHotSpots();
                    Pane affHS1 = paneAffichageHS(strListePano(), iNumPano);
                    affHS1.setId("labels");
                    vbVisuHotspots.getChildren().add(affHS1);
                }
            });
            if (iNum11 != -1) {
                int iNumPan = iNum11;
                ImageView ivAfficheVignettePano = new ImageView(
                        getPanoramiquesProjet()[iNum11].getImgPanoRect());
                ivAfficheVignettePano.setPreserveRatio(true);
                ivAfficheVignettePano.setFitWidth(300);
                ivAfficheVignettePano.setLayoutY(10);
                ivAfficheVignettePano.setCursor(Cursor.HAND);
                ivAfficheVignettePano.setOnMouseClicked((e) -> {
                    affichePanoChoisit(iNumPan);
                });
                AnchorPane apVisuVignettePano = new AnchorPane(ivAfficheVignettePano);
                apVisuVignettePano.setPrefHeight(170);
                apVisuVignettePano.setTranslateX(10);
                vbPanneauHS.getChildren().addAll(lblLien, cbDestPano, apVisuVignettePano, lblSep);
            } else {
                vbPanneauHS.getChildren().addAll(lblLien, cbDestPano, lblSep);
            }

        }
        Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot"));
        lblTexteHS.setTranslateX(10);
        TextField tfTexteHS = new TextField();
        if (getPanoramiquesProjet()[iNumPano].getHotspot(io).getStrInfo() != null) {
            tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspot(io).getStrInfo());
        }
        tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        tfTexteHS.setId("txtHS" + io);
        tfTexteHS.setPrefSize(200, 25);
        tfTexteHS.setMaxSize(200, 20);
        tfTexteHS.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(lblTexteHS, tfTexteHS, lblSep1);
        vbHotspots.getChildren().addAll(paneHsPanoramique, lblSep);
    }
    int iNbHS = io;
    int iTaillePane = io * 325;
    for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspotImage(); io++) {
        Label lblSep = new Label(" ");
        Label lblSep1 = new Label(" ");
        VBox vbPanneauHsImage = new VBox();
        Pane paneHsImage = new Pane(vbPanneauHsImage);
        int iNum = io;
        Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#img" + iNum);
            if (c1 != null) {
                if (c1.getFill() == Color.BLUE) {
                    c1.setFill(Color.YELLOW);
                    c1.setStroke(Color.BLUE);
                } else {
                    c1.setFill(Color.BLUE);
                    c1.setStroke(Color.YELLOW);
                }
            }
        }));
        timBouge.setCycleCount(Timeline.INDEFINITE);
        timBouge.pause();
        paneHsImage.setOnMouseEntered((e) -> {
            timBouge.play();
        });
        paneHsImage.setOnMouseExited((e) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#img" + iNum);
            if (c1 != null) {

                c1.setFill(Color.BLUE);
                c1.setStroke(Color.YELLOW);
            }
            timBouge.pause();
        });
        paneHsImage.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;");
        paneHsImage.setId("HSImg" + io);
        lblPoint = new Label("Image #" + (io + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.getStyleClass().add("titreOutil");
        Separator sepHS = new Separator(Orientation.HORIZONTAL);
        sepHS.setPrefWidth(321);
        sepHS.setTranslateX(2);

        paneHsImage.setPrefWidth(325);
        vbPanneauHsImage.getChildren().addAll(lblPoint, sepHS);
        Label lblLien = new Label(rbLocalisation.getString("main.imageChoisie"));
        lblLien.setTranslateX(10);

        String strF1XML = getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrLienImg();
        Image imgChoisie = new Image(
                "file:" + getStrRepertTemp() + File.separator + "images" + File.separator + strF1XML);
        ImageView ivChoisie = new ImageView(imgChoisie);
        ivChoisie.setTranslateX(100);
        ivChoisie.setFitWidth(100);
        ivChoisie.setFitHeight(imgChoisie.getHeight() / imgChoisie.getWidth() * 100);

        vbPanneauHsImage.getChildren().addAll(lblLien, ivChoisie, lblSep);
        Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot"));
        lblTexteHS.setTranslateX(10);

        TextField tfTexteHS = new TextField();
        if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrInfo() != null) {
            tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrInfo());
        }
        tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        tfTexteHS.setId("txtHSImage" + io);
        tfTexteHS.setPrefSize(200, 25);
        tfTexteHS.setMaxSize(200, 20);
        tfTexteHS.setTranslateX(60);
        vbPanneauHsImage.getChildren().addAll(lblTexteHS, tfTexteHS, lblSep1);
        Label lblCoulFond = new Label(rbLocalisation.getString("diapo.couleurFond"));
        lblCoulFond.setTranslateX(10);
        Label lblOpacite = new Label(rbLocalisation.getString("diapo.opacite"));
        lblOpacite.setTranslateX(10);
        if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrCouleurFond().equals("")) {
            getPanoramiquesProjet()[iNumPano].getHotspotImage(io).setStrCouleurFond(
                    "#" + getGestionnaireInterface().getCouleurFondTheme().toString().substring(2, 8));
        }
        ColorPicker cpCouleurFond = new ColorPicker(
                Color.valueOf(getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrCouleurFond()));
        if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getOpacite() == -1) {
            getPanoramiquesProjet()[iNumPano].getHotspotImage(io)
                    .setOpacite(getGestionnaireInterface().getOpaciteTheme());
        }
        cpCouleurFond.setTranslateX(100);
        int i = io;
        cpCouleurFond.valueProperty().addListener((ov, av, nv) -> {
            if (getiNombrePanoramiques() != 0) {
                setbDejaSauve(false);
                getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *");
            }
            getPanoramiquesProjet()[iNumPano].getHotspotImage(i)
                    .setStrCouleurFond("#" + cpCouleurFond.getValue().toString().substring(2, 8));
        });
        Slider slOpacite = new Slider(0, 1, getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getOpacite());
        slOpacite.valueProperty().addListener((ov, av, nv) -> {
            if (getiNombrePanoramiques() != 0) {
                setbDejaSauve(false);
                getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *");
            }
            getPanoramiquesProjet()[iNumPano].getHotspotImage(i).setOpacite(slOpacite.getValue());
        });
        slOpacite.setTranslateX(100);
        slOpacite.setPrefWidth(130);
        slOpacite.setMinWidth(130);
        slOpacite.setMaxWidth(130);
        vbPanneauHsImage.getChildren().addAll(lblCoulFond, cpCouleurFond, lblOpacite, slOpacite);

        vbHotspots.getChildren().addAll(paneHsImage, lblSep);
        iTaillePane += 225 + ivChoisie.getFitHeight();
        paneHsImage.setPrefHeight(200 + ivChoisie.getFitHeight());
        paneHsImage.setMinHeight(200 + ivChoisie.getFitHeight());
        paneHsImage.setMaxHeight(200 + ivChoisie.getFitHeight());
    }

    iNbHS += io;

    for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspotHTML(); io++) {
        Label lblSep = new Label(" ");
        int iNum = io;
        VBox vbPanneauHS = new VBox();
        Pane paneHsHtml = new Pane(vbPanneauHS);
        Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum);
            if (c1 != null) {

                if (c1.getFill() == Color.DARKGREEN) {
                    c1.setFill(Color.YELLOWGREEN);
                    c1.setStroke(Color.DARKGREEN);
                } else {
                    c1.setFill(Color.DARKGREEN);
                    c1.setStroke(Color.YELLOWGREEN);
                }
            }
        }));
        timBouge.setCycleCount(Timeline.INDEFINITE);
        timBouge.pause();
        paneHsHtml.setOnMouseEntered((e) -> {
            timBouge.play();
        });
        paneHsHtml.setOnMouseExited((e) -> {
            timBouge.pause();
            Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum);
            if (c1 != null) {
                c1.setFill(Color.DARKGREEN);
                c1.setStroke(Color.YELLOWGREEN);
            }
        });
        paneHsHtml.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;");
        paneHsHtml.setId("HSHTML" + io);
        lblPoint = new Label("Hotspot HTML #" + (io + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.getStyleClass().add("titreOutil");
        Separator sepHS = new Separator(Orientation.HORIZONTAL);
        sepHS.setPrefWidth(321);
        sepHS.setTranslateX(2);
        paneHsHtml.setPrefWidth(325);
        Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot"));
        lblTexteHS.setTranslateX(10);
        TextField tfTexteHS = new TextField();
        if (getPanoramiquesProjet()[iNumPano].getHotspotHTML(io).getStrInfo() != null) {
            tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotHTML(io).getStrInfo());
        }
        tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        tfTexteHS.setId("txtHSHTML" + io);
        tfTexteHS.setPrefSize(200, 25);
        tfTexteHS.setMaxSize(200, 20);
        tfTexteHS.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(lblPoint, sepHS, lblTexteHS, tfTexteHS);
        Button btnEditeHSHTML = new Button(rbLocalisation.getString("main.editeHTML"));
        btnEditeHSHTML.setPrefWidth(80);
        btnEditeHSHTML.setTranslateX(paneHsHtml.getPrefWidth() - btnEditeHSHTML.getPrefWidth() - 10);
        vbPanneauHS.getChildren().addAll(btnEditeHSHTML);
        btnEditeHSHTML.setOnAction((e) -> {
            EditeurHTML editHTML = new EditeurHTML();
            HotspotHTML HS = getPanoramiquesProjet()[iNumPano].getHotspotHTML(iNum);
            editHTML.setHsHTML(HS);
            Rectangle2D tailleEcran = Screen.getPrimary().getBounds();
            int iHauteur = (int) tailleEcran.getHeight() - 100;
            int iLargeur = (int) tailleEcran.getWidth() - 100;
            editHTML.affiche(iLargeur, iHauteur);
            editHTML.addPropertyChangeListener("bValide", (ev) -> {
                if (ev.getNewValue().toString().equals("true")) {
                    getPanoramiquesProjet()[iNumPano].setHotspotHTML(editHTML.getHsHTML(), iNum);
                    dejaCharge = false;
                    retireAffichageHotSpots();
                    Pane affHS1 = paneAffichageHS(strListePano(), iNumPano);
                    affHS1.setId("labels");
                    vbVisuHotspots.getChildren().add(affHS1);
                }
            });

        });

        vbHotspots.getChildren().addAll(paneHsHtml, lblSep);
        paneHsHtml.setPrefHeight(120);
        paneHsHtml.setMinHeight(120);
        paneHsHtml.setMaxHeight(120);
        iTaillePane += 145;
    }
    iNbHS += io;
    for (io = 0; io < getPanoramiquesProjet()[iNumPano].getiNombreHotspotDiapo(); io++) {
        Label lblSep = new Label(" ");
        int iNum = io;
        VBox vbPanneauHS = new VBox();
        Pane paneHsDiapo = new Pane(vbPanneauHS);
        Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#dia" + iNum);
            if (c1 != null) {

                if (c1.getFill() == Color.TURQUOISE) {
                    c1.setFill(Color.ORANGE);
                    c1.setStroke(Color.TURQUOISE);
                } else {
                    c1.setFill(Color.TURQUOISE);
                    c1.setStroke(Color.ORANGE);
                }
            }
        }));
        timBouge.setCycleCount(Timeline.INDEFINITE);
        timBouge.pause();
        paneHsDiapo.setOnMouseEntered((e) -> {
            timBouge.play();
        });
        paneHsDiapo.setOnMouseExited((e) -> {
            timBouge.pause();
            Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum);
            if (c1 != null) {
                c1.setFill(Color.TURQUOISE);
                c1.setStroke(Color.ORANGE);
            }
        });
        paneHsDiapo.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;");
        paneHsDiapo.setId("DIAPO" + io);
        lblPoint = new Label("Hotspot Diaporama #" + (io + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.getStyleClass().add("titreOutil");
        Separator sepHS = new Separator(Orientation.HORIZONTAL);
        sepHS.setPrefWidth(321);
        sepHS.setTranslateX(2);
        paneHsDiapo.setPrefWidth(325);
        Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot"));
        lblTexteHS.setTranslateX(10);
        TextField tfTexteHS = new TextField();
        if (getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getStrInfo() != null) {
            tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getStrInfo());
        }
        tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        tfTexteHS.setId("txtDIA" + io);
        tfTexteHS.setPrefSize(200, 25);
        tfTexteHS.setMaxSize(200, 20);
        tfTexteHS.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(lblPoint, sepHS, lblTexteHS, tfTexteHS);
        ComboBox cbListeDiapo = new ComboBox();
        for (int i = 0; i < getiNombreDiapo(); i++) {
            cbListeDiapo.getItems().add(diaporamas[i].getStrNomDiaporama());
        }
        cbListeDiapo.getSelectionModel()
                .select(getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getiNumDiapo());
        int iii = io;
        cbListeDiapo.getSelectionModel().selectedIndexProperty().addListener((ov, av, nv) -> {
            getPanoramiquesProjet()[iNumPano].getHotspotDiapo(iii).setiNumDiapo((int) nv);
        });
        cbListeDiapo.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(cbListeDiapo);
        //Ajouter Liste Diaporamas
        vbHotspots.getChildren().addAll(paneHsDiapo, lblSep);
        paneHsDiapo.setPrefHeight(120);
        paneHsDiapo.setMinHeight(120);
        paneHsDiapo.setMaxHeight(120);
        iTaillePane += 145;
    }
    valideHS();
    iNbHS += io;
    dejaCharge = true;
    paneHotSpots.setPrefHeight(iTaillePane);
    paneHotSpots.setMinHeight(iTaillePane);
    paneHotSpots.setMaxHeight(iTaillePane);
    paneHotSpots.setId("labels");
    apVisuHS.setPrefHeight(paneHotSpots.getPrefHeight());
    apVisuHS.setMinHeight(paneHotSpots.getPrefHeight());
    apVisuHS.setMaxHeight(paneHotSpots.getPrefHeight());
    vbVisuHotspots.setPrefHeight(paneHotSpots.getPrefHeight());
    vbVisuHotspots.setMinHeight(paneHotSpots.getPrefHeight());
    vbVisuHotspots.setMaxHeight(paneHotSpots.getPrefHeight());

    return paneHotSpots;
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @return/*www.  ja  va  2 s.  c  o m*/
 */
private static ScrollPane spAfficheLegende() {
    double positionX;
    double positionY;
    AnchorPane apLegende = new AnchorPane();
    ScrollPane spLegende = new ScrollPane(apLegende);
    spLegende.getStyleClass().add("legendePane");

    apLegende.setMinWidth(1000);
    apLegende.setMinHeight(150);
    apLegende.setPrefWidth(1000);
    apLegende.setPrefHeight(150);
    apLegende.setMaxWidth(1000);
    apLegende.setMaxHeight(150);
    positionY = (spVuePanoramique.getPrefHeight() - apLegende.getPrefHeight() - 15);

    Circle circPoint = new Circle(30, 20, 5);
    circPoint.setFill(Color.YELLOW);
    circPoint.setStroke(Color.RED);
    circPoint.setCursor(Cursor.DEFAULT);
    Circle circPoint2 = new Circle(30, 40, 5);
    circPoint2.setFill(Color.BLUE);
    circPoint2.setStroke(Color.YELLOW);
    circPoint2.setCursor(Cursor.DEFAULT);
    Circle circPoint3 = new Circle(30, 60, 5);
    circPoint3.setFill(Color.GREEN);
    circPoint3.setStroke(Color.YELLOW);
    circPoint3.setCursor(Cursor.DEFAULT);
    Polygon polygonCroix = new Polygon();
    polygonCroix.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 });
    polygonCroix.setStrokeLineJoin(StrokeLineJoin.MITER);
    polygonCroix.setFill(Color.BLUEVIOLET);
    polygonCroix.setStroke(Color.YELLOW);
    polygonCroix.setId("PoV");
    polygonCroix.setLayoutX(500);
    polygonCroix.setLayoutY(20);
    Label lblHS = new Label(rbLocalisation.getString("main.legendeHS"));
    Label lblHSImage = new Label(rbLocalisation.getString("main.legendeHSImage"));
    Label lblHSHTML = new Label(rbLocalisation.getString("main.legendeHSHTML"));
    Label lblPoV = new Label(rbLocalisation.getString("main.legendePoV"));
    Label lblNord = new Label(rbLocalisation.getString("main.legendeNord"));
    Line lineNord = new Line(500, 45, 500, 65);
    lineNord.setStroke(Color.RED);
    lineNord.setStrokeWidth(3);
    lblHS.setLayoutX(50);
    lblHS.setLayoutY(15);
    lblHSImage.setLayoutX(50);
    lblHSImage.setLayoutY(35);
    lblHSHTML.setLayoutX(50);
    lblHSHTML.setLayoutY(55);
    lblPoV.setLayoutX(520);
    lblPoV.setLayoutY(15);
    lblNord.setLayoutX(520);
    lblNord.setLayoutY(55);
    apLegende.getChildren().addAll(lblHS, circPoint, lblHSImage, circPoint2, lblHSHTML, circPoint3, lblPoV,
            polygonCroix, lblNord, lineNord);
    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   ww w.ja v  a 2s. c om*/
 * @param longitude
 * @param latitude
 */
private static void afficheHSImage(int i, double longitude, double latitude) {
    double largeur = ivImagePanoramique.getFitWidth();
    double X = (longitude + 180.0d) * largeur / 360.0d + ivImagePanoramique.getLayoutX();
    double Y = (90.0d - latitude) * largeur / 360.0d;
    Circle circPoint = new Circle(X, Y, 5);
    circPoint.setFill(Color.BLUE);
    circPoint.setStroke(Color.YELLOW);
    circPoint.setId("img" + i);
    circPoint.setCursor(Cursor.DEFAULT);
    panePanoramique.getChildren().add(circPoint);
    Tooltip tltpHSImage = new Tooltip("image #" + (i + 1));
    tltpHSImage.setStyle(getStrTooltipStyle());
    Tooltip.install(circPoint, tltpHSImage);
    circPoint.setOnDragDetected((mouseEvent1) -> {
        circPoint.setFill(Color.YELLOW);
        circPoint.setStroke(Color.BLUE);
        bDragDrop = true;
        mouseEvent1.consume();

    });
    circPoint.setOnMouseDragged((mouseEvent1) -> {
        double XX = mouseEvent1.getX() - ivImagePanoramique.getLayoutX();
        if (XX < 0) {
            XX = 0;
        }
        if (XX > ivImagePanoramique.getFitWidth()) {
            XX = ivImagePanoramique.getFitWidth();
        }
        circPoint.setCenterX(XX + ivImagePanoramique.getLayoutX());
        double YY = mouseEvent1.getY();
        if (YY < 0) {
            YY = 0;
        }
        if (YY > ivImagePanoramique.getFitHeight()) {
            YY = ivImagePanoramique.getFitHeight();
        }
        circPoint.setCenterY(YY);
        afficheLoupe(XX, YY);
        mouseEvent1.consume();

    });
    circPoint.setOnMouseReleased((mouseEvent1) -> {
        String strPoint = circPoint.getId();
        strPoint = strPoint.substring(3, strPoint.length());
        int iNumeroPoint = Integer.parseInt(strPoint);
        double X1 = mouseEvent1.getSceneX();
        double Y1 = mouseEvent1.getSceneY();
        double mouseX = X1 - ivImagePanoramique.getLayoutX();
        if (mouseX < 0) {
            mouseX = 0;
        }
        if (mouseX > ivImagePanoramique.getFitWidth()) {
            mouseX = ivImagePanoramique.getFitWidth();
        }
        double mouseY = Y1 - panePanoramique.getLayoutY() - 130 - getiDecalageMac();
        if (mouseY < 0) {
            mouseY = 0;
        }
        if (mouseY > ivImagePanoramique.getFitHeight()) {
            mouseY = ivImagePanoramique.getFitHeight();
        }

        double longit, lat;
        double larg = ivImagePanoramique.getFitWidth();
        String strLong, strLat;
        longit = 360.0f * mouseX / larg - 180;
        lat = 90.0d - 2.0f * mouseY / larg * 180.0f;
        getPanoramiquesProjet()[getiPanoActuel()].getHotspotImage(iNumeroPoint).setLatitude(lat);
        getPanoramiquesProjet()[getiPanoActuel()].getHotspotImage(iNumeroPoint).setLongitude(longit);
        circPoint.setFill(Color.BLUE);
        circPoint.setStroke(Color.YELLOW);
        mouseEvent1.consume();

    });

    circPoint.setOnMouseClicked((mouseEvent1) -> {
        String strPoint = circPoint.getId();
        strPoint = strPoint.substring(3, strPoint.length());
        int iNum = Integer.parseInt(strPoint);
        Node nodePointImage;
        nodePointImage = (Node) panePanoramique.lookup("#img" + strPoint);

        if (mouseEvent1.isControlDown()) {
            valideHS();
            setbDejaSauve(false);
            getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *");
            panePanoramique.getChildren().remove(nodePointImage);

            for (int io = iNum + 1; io < getiNumImages(); io++) {
                nodePointImage = (Node) panePanoramique.lookup("#img" + Integer.toString(io));
                nodePointImage.setId("img" + Integer.toString(io - 1));
            }
            /**
             * on retire les anciennes indication de HS
             */
            retireAffichageHotSpots();
            setiNumImages(getiNumImages() - 1);
            getPanoramiquesProjet()[getiPanoActuel()].removeHotspotImage(iNum);
            /**
             * On les cre les nouvelles
             */
            ajouteAffichageHotspots();
            mouseEvent1.consume();
        } else {
            if (!bDragDrop) {
                File fileRepert;
                if (getStrRepertHSImages().equals("")) {
                    fileRepert = new File(getStrCurrentDir() + File.separator);
                } else {
                    fileRepert = new File(getStrRepertHSImages());
                }
                FileChooser fileChooser = new FileChooser();
                FileChooser.ExtensionFilter extFilterImages = new FileChooser.ExtensionFilter(
                        "Fichiers Images (jpg, bmp, png)", "*.jpg", "*.bmp", "*.png");

                fileChooser.setInitialDirectory(fileRepert);
                fileChooser.getExtensionFilters().addAll(extFilterImages);

                File fileFichierImage = fileChooser.showOpenDialog(null);
                if (fileFichierImage != null) {
                    setStrRepertHSImages(fileFichierImage.getParent());
                    HotspotImage HS = getPanoramiquesProjet()[getiPanoActuel()].getHotspotImage(iNum);
                    HS.setStrUrlImage(fileFichierImage.getAbsolutePath());
                    HS.setStrLienImg(fileFichierImage.getName());
                    HS.setStrInfo(fileFichierImage.getName().split("\\.")[0]);
                    File fileRepertImage = new File(getStrRepertTemp() + File.separator + "images");
                    if (!fileRepertImage.exists()) {
                        fileRepertImage.mkdirs();
                    }
                    try {
                        copieFichierRepertoire(fileFichierImage.getAbsolutePath(),
                                fileRepertImage.getAbsolutePath());

                    } catch (IOException ex) {
                        Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    getPanoramiquesProjet()[getiPanoActuel()].setHotspotImage(HS, iNum);
                    retireAffichageHotSpots();
                    Pane affHS1 = paneAffichageHS(strListePano(), getiPanoActuel());
                    affHS1.setId("labels");
                    vbVisuHotspots.getChildren().add(affHS1);
                }
            } else {
                bDragDrop = false;
            }
            mouseEvent1.consume();
        }

    });
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param X/*from w ww  .j a va2s.  c om*/
 * @param Y
 */
private static void panoAjouteImage(double X, double Y) {
    if (X > 0 && X < ivImagePanoramique.getFitWidth()) {
        valideHS();
        setbDejaSauve(false);
        getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *");

        double mouseX = X;
        double mouseY = Y - panePanoramique.getLayoutY() - 130 - getiDecalageMac();
        double longitude, latitude;
        double largeur = ivImagePanoramique.getFitWidth();
        longitude = 360.0f * mouseX / largeur - 180;
        latitude = 90.0d - 2.0f * mouseY / largeur * 180.0f;
        Circle circPoint = new Circle(mouseX + ivImagePanoramique.getLayoutX(), mouseY, 5);
        circPoint.setFill(Color.BLUE);
        circPoint.setStroke(Color.YELLOW);
        circPoint.setId("img" + getiNumImages());
        circPoint.setCursor(Cursor.DEFAULT);
        panePanoramique.getChildren().add(circPoint);
        Tooltip tltpImage = new Tooltip("image n " + (getiNumImages() + 1));
        tltpImage.setStyle(getStrTooltipStyle());
        Tooltip.install(circPoint, tltpImage);
        File fileRepert;
        if (getStrRepertHSImages().equals("")) {
            fileRepert = new File(getStrCurrentDir() + File.separator);
        } else {
            fileRepert = new File(getStrRepertHSImages());
        }
        FileChooser fileChooser = new FileChooser();
        FileChooser.ExtensionFilter extFilterImages = new FileChooser.ExtensionFilter(
                "Fichiers Images (jpg, bmp, png)", "*.jpg", "*.bmp", "*.png");

        fileChooser.setInitialDirectory(fileRepert);
        fileChooser.getExtensionFilters().addAll(extFilterImages);

        File fileFichierImage = fileChooser.showOpenDialog(null);
        if (fileFichierImage != null) {
            setStrRepertHSImages(fileFichierImage.getParent());
            setiNumImages(getiNumImages() + 1);
            HotspotImage HS = new HotspotImage();
            HS.setLongitude(longitude);
            HS.setLatitude(latitude);
            HS.setStrUrlImage(fileFichierImage.getAbsolutePath());
            HS.setStrLienImg(fileFichierImage.getName());
            HS.setStrInfo(fileFichierImage.getName().split("\\.")[0]);
            File fileRepertImage = new File(getStrRepertTemp() + File.separator + "images");
            if (!fileRepertImage.exists()) {
                fileRepertImage.mkdirs();
            }
            try {
                copieFichierRepertoire(fileFichierImage.getAbsolutePath(), fileRepertImage.getAbsolutePath());

            } catch (IOException ex) {
                Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
            }
            getPanoramiquesProjet()[getiPanoActuel()].addHotspotImage(HS);
            retireAffichageHotSpots();
            dejaCharge = false;
            Pane affHS1 = paneAffichageHS(strListePano(), getiPanoActuel());
            affHS1.setId("labels");
            vbVisuHotspots.getChildren().add(affHS1);
            spPanneauOutils.setVvalue(spPanneauOutils.getVvalue() + 300);

        } else {
            String strPoint = circPoint.getId();
            strPoint = strPoint.substring(3, strPoint.length());
            Node nodeImage = (Node) panePanoramique.lookup("#img" + strPoint);
            panePanoramique.getChildren().remove(nodeImage);
        }
        valideHS();
        circPoint.setOnDragDetected((mouseEvent1) -> {
            circPoint.setFill(Color.YELLOW);
            circPoint.setStroke(Color.BLUE);
            bDragDrop = true;
            mouseEvent1.consume();

        });
        circPoint.setOnMouseDragged((mouseEvent1) -> {
            double XX = mouseEvent1.getX() - ivImagePanoramique.getLayoutX();
            if (XX < 0) {
                XX = 0;
            }
            if (XX > ivImagePanoramique.getFitWidth()) {
                XX = ivImagePanoramique.getFitWidth();
            }
            circPoint.setCenterX(XX + ivImagePanoramique.getLayoutX());
            double YY = mouseEvent1.getY();
            if (YY < 0) {
                YY = 0;
            }
            if (YY > ivImagePanoramique.getFitHeight()) {
                YY = ivImagePanoramique.getFitHeight();
            }
            circPoint.setCenterY(YY);
            afficheLoupe(XX, YY);

            mouseEvent1.consume();

        });
        circPoint.setOnMouseReleased((mouseEvent1) -> {
            setbDejaSauve(false);
            getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *");
            String strPoint = circPoint.getId();
            strPoint = strPoint.substring(3, strPoint.length());
            int iNumeroPoint = Integer.parseInt(strPoint);
            double X1 = mouseEvent1.getSceneX();
            double Y1 = mouseEvent1.getSceneY();
            double mouseX1 = X1 - ivImagePanoramique.getLayoutX();
            if (mouseX1 < 0) {
                mouseX1 = 0;
            }
            if (mouseX1 > ivImagePanoramique.getFitWidth()) {
                mouseX1 = ivImagePanoramique.getFitWidth();
            }

            double mouseY1 = Y1 - panePanoramique.getLayoutY() - 130 - getiDecalageMac();
            if (mouseY1 < 0) {
                mouseY1 = 0;
            }
            if (mouseY1 > ivImagePanoramique.getFitHeight()) {
                mouseY1 = ivImagePanoramique.getFitHeight();
            }

            double longit, lat;
            double larg = ivImagePanoramique.getFitWidth();
            longit = 360.0f * mouseX1 / larg - 180;
            lat = 90.0d - 2.0f * mouseY1 / larg * 180.0f;
            getPanoramiquesProjet()[getiPanoActuel()].getHotspotImage(iNumeroPoint).setLatitude(lat);
            getPanoramiquesProjet()[getiPanoActuel()].getHotspotImage(iNumeroPoint).setLongitude(longit);
            circPoint.setFill(Color.BLUE);
            circPoint.setStroke(Color.YELLOW);
            mouseEvent1.consume();

        });

        circPoint.setOnMouseClicked((mouseEvent1) -> {
            String strPoint = circPoint.getId();
            strPoint = strPoint.substring(3, strPoint.length());
            int iNum = Integer.parseInt(strPoint);
            if (mouseEvent1.isControlDown()) {
                setbDejaSauve(false);
                getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *");
                Node nodeImage;
                nodeImage = (Node) panePanoramique.lookup("#img" + strPoint);
                panePanoramique.getChildren().remove(nodeImage);

                for (int io = iNum + 1; io < getiNumImages(); io++) {
                    nodeImage = (Node) panePanoramique.lookup("#img" + Integer.toString(io));
                    nodeImage.setId("img" + Integer.toString(io - 1));
                }
                /**
                 * on retire les anciennes indication de HS
                 */
                retireAffichageHotSpots();
                setiNumImages(getiNumImages() - 1);
                getPanoramiquesProjet()[getiPanoActuel()].removeHotspotImage(iNum);
                /**
                 * On les cre les nouvelles
                 */
                ajouteAffichageHotspots();
            } else {
                if (!bDragDrop) {
                    setbDejaSauve(false);
                    getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *");
                    File fileRepert1;
                    if (getStrRepertHSImages().equals("")) {
                        fileRepert1 = new File(getStrCurrentDir() + File.separator);
                    } else {
                        fileRepert1 = new File(getStrRepertHSImages());
                    }
                    FileChooser fileChooser1 = new FileChooser();
                    FileChooser.ExtensionFilter extFilterImages1 = new FileChooser.ExtensionFilter(
                            "Fichiers Images (jpg, bmp, png)", "*.jpg", "*.bmp", "*.png");

                    fileChooser1.setInitialDirectory(fileRepert1);
                    fileChooser1.getExtensionFilters().addAll(extFilterImages1);

                    File fileFichierImage1 = fileChooser1.showOpenDialog(null);
                    if (fileFichierImage1 != null) {
                        setStrRepertHSImages(fileFichierImage1.getParent());
                        HotspotImage HS = getPanoramiquesProjet()[getiPanoActuel()].getHotspotImage(iNum);
                        HS.setStrUrlImage(fileFichierImage1.getAbsolutePath());
                        HS.setStrLienImg(fileFichierImage1.getName());
                        HS.setStrInfo(fileFichierImage1.getName().split("\\.")[0]);
                        File fileRepertImage = new File(getStrRepertTemp() + File.separator + "images");
                        if (!fileRepertImage.exists()) {
                            fileRepertImage.mkdirs();
                        }
                        try {
                            copieFichierRepertoire(fileFichierImage1.getAbsolutePath(),
                                    fileRepertImage.getAbsolutePath());

                        } catch (IOException ex) {
                            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
                        }
                        getPanoramiquesProjet()[getiPanoActuel()].setHotspotImage(HS, iNum);
                        retireAffichageHotSpots();
                        dejaCharge = false;
                        Pane affHS1 = paneAffichageHS(strListePano(), getiPanoActuel());
                        affHS1.setId("labels");
                        vbVisuHotspots.getChildren().add(affHS1);
                    }
                } else {
                    bDragDrop = false;
                }
            }
            valideHS();
            mouseEvent1.consume();
        });

    }
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 *///from ww w  .  j a v a  2 s  . co m
private static void installeEvenements() {
    /**
     *
     */
    getScnPrincipale().widthProperty().addListener(
            (ObservableValue<? extends Number> observableValue, Number oldSceneWidth, Number newSceneWidth) -> {
                if ((double) newSceneWidth < 1280) {
                }
                double largeur = (double) newSceneWidth - largeurOutils - 20;
                apPanovisu.setLayoutX((double) newSceneWidth - largeurOutils);
                spVuePanoramique.setPrefWidth(largeur);
                spVuePanoramique.setBackground(
                        new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY)));
                gestionnaireInterface.getApVis().setPrefWidth((double) newSceneWidth - largeurOutils - 20);
                if ((double) newSceneWidth - largeurOutils - 20 < gestionnaireInterface.getApVis()
                        .getMaxWidth()) {
                    gestionnaireInterface.getApVis().setMinWidth((double) newSceneWidth - largeurOutils - 20);
                }
                if ((double) newSceneWidth - largeurOutils - 20 < gestionnairePlan.getApPlan().getMaxWidth()) {
                    gestionnairePlan.getApPlan().setMinWidth((double) newSceneWidth - largeurOutils - 20);
                }
                gestionnairePlan.getApPlan().setPrefWidth((double) newSceneWidth - largeurOutils - 20);

            });
    /**
     *
     */
    getScnPrincipale().heightProperty().addListener((ObservableValue<? extends Number> observableValue,
            Number oldSceneHeight, Number newSceneHeight) -> {
        spVuePanoramique.setPrefHeight((double) newSceneHeight - 130.0d - getiDecalageMac());
        spPanneauOutils.setPrefHeight((double) newSceneHeight - 130.0d - getiDecalageMac());

        spVuePanoramique
                .setBackground(new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY)));
        if ((double) newSceneHeight - 130.0d - getiDecalageMac() < gestionnaireInterface.getSpOutils()
                .getMaxHeight()) {
            gestionnaireInterface.getSpOutils()
                    .setMinHeight((double) newSceneHeight - 130.0d - getiDecalageMac());
        }

        gestionnaireInterface.getSpOutils().setPrefHeight((double) newSceneHeight - 130.0d - getiDecalageMac());
        gestionnairePlan.getSpOutils().setPrefHeight((double) newSceneHeight - 130 - getiDecalageMac());

        if ((double) newSceneHeight - 130 - getiDecalageMac() < gestionnairePlan.getSpOutils().getMaxHeight()) {
            gestionnairePlan.getSpOutils().setMinHeight((double) newSceneHeight - 130 - getiDecalageMac());
        }
    });

    getScnPrincipale().setOnKeyPressed((clavierEvt) -> {
        //System.out.println("Code clavier : " + clavierEvt.getCode());
        if (clavierEvt.isControlDown()) {
            if (clavierEvt.getText().toLowerCase().equals("l")) {
                clavierEvt.consume();
                setAfficheLoupe(!isAfficheLoupe());
                apLoupe.setVisible(isAfficheLoupe());
                Point p = MouseInfo.getPointerInfo().getLocation();
                if (p.x < getiTailleLoupe() + 80 && p.y < getiTailleLoupe() + 160) {
                    apLoupe.setLayoutX(ivImagePanoramique.getFitWidth() - getiTailleLoupe() + 5);
                    apLoupe.setLayoutY(35);
                    strPositLoupe = "droite";
                } else {
                    apLoupe.setLayoutX(35);
                    apLoupe.setLayoutY(35);
                    strPositLoupe = "gauche";
                }
            }
        }
        if (clavierEvt.getText().equals("+")) {
            setiTailleLoupe(getiTailleLoupe() + 10);
            creeLoupe();
            afficheLoupe(positLoupeX, positLoupeY);
        }
        if (clavierEvt.getText().equals("-")) {
            setiTailleLoupe(getiTailleLoupe() - 10);
            creeLoupe();
            afficheLoupe(positLoupeX, positLoupeY);
        }
    });

    /**
     *
     */
    panePanoramique.setOnMouseClicked((mouseEvent) -> {
        gereSourisPanoramique(mouseEvent);
    });
    /**
     *
     */
    panePanoramique.setOnMouseMoved((mouseEvent) -> {
        if (bEstCharge) {
            double mouseX = mouseEvent.getSceneX() - ivImagePanoramique.getLayoutX();
            if (mouseX < 0) {
                mouseX = 0;
            }
            if (mouseX > ivImagePanoramique.getFitWidth()) {
                mouseX = ivImagePanoramique.getFitWidth();
            }
            double mouseY = mouseEvent.getSceneY() - panePanoramique.getLayoutY() - 130 - getiDecalageMac();
            if (mouseY < 0) {
                mouseY = 0;
            }
            if (mouseY > ivImagePanoramique.getFitHeight()) {
                mouseY = ivImagePanoramique.getFitHeight();
            }

            double longitude, latitude;
            double largeur = ivImagePanoramique.getFitWidth() * panePanoramique.getScaleX();
            longitude = 360.0f * mouseX / largeur - 180;
            latitude = 90.0d - 2.0f * mouseY / largeur * 180.0f;
            String strLong = "Long : " + String.format("%.1f", longitude);
            String strLat = "Lat : " + String.format("%.1f", latitude);
            lblLong.setText(strLong);
            lblLat.setText(strLat);
            afficheLoupe(mouseX, mouseY);
        }
    });
    cbListeChoixPanoramique.valueProperty().addListener((ov, ancienneValeur, nouvelleValeur) -> {
        if (nouvelleValeur != null) {
            if (!(nouvelleValeur.equals(strPanoAffiche))) {
                valideHS();
                strPanoAffiche = nouvelleValeur.toString();
            }
        }
    });

}

From source file:org.noroomattheinn.visibletesla.LocationController.java

@Override
protected void fxInitialize() {
    engine = webView.getEngine();/*from w ww  .j a  v  a  2  s  .  c o m*/
    progressIndicator.setVisible(false);
    multigauge = new MultiGauge(25, 8, 0, 100, -60, 320);
    multigauge.useGradient(Side.RIGHT, Color.DARKORANGE, Color.GREEN);
    multigauge.useGradient(Side.LEFT, Color.BLUE, Color.BLUE);
    multigauge.setLogScale(Side.RIGHT, true);
    Node mg = multigauge.getContainer();
    AnchorPane.setTopAnchor(mg, 25.0);
    AnchorPane.setRightAnchor(mg, 10.0);
    root.getChildren().add(2, mg);
    multigauge.setVal(Side.LEFT, 20);
    multigauge.setVal(Side.RIGHT, 40);
}