Example usage for javafx.scene.control ScrollPane setLayoutX

List of usage examples for javafx.scene.control ScrollPane setLayoutX

Introduction

In this page you can find the example usage for javafx.scene.control ScrollPane setLayoutX.

Prototype

public final void setLayoutX(double value) 

Source Link

Usage

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   ww  w. j  a v  a 2s.  c o  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

/**
 *
 * @return//from  ww  w  . j a v a 2  s. c  om
 */
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;
}