Java Code Examples for javafx.scene.paint.Color#BEIGE

The following examples show how to use javafx.scene.paint.Color#BEIGE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScrollPaneSample2.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) {
    VBox box = new VBox();
    Scene scene = new Scene(box, 180, 180);
    stage.setScene(scene);
    stage.setTitle("ScrollPaneSample");
    box.getChildren().addAll(sp, fileName);
    VBox.setVgrow(sp, Priority.ALWAYS);

    fileName.setLayoutX(30);
    fileName.setLayoutY(160);
    sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);

    Color[] colors = new Color[] { Color.RED, Color.ALICEBLUE, Color.AQUA, Color.BEIGE, Color.BLANCHEDALMOND };
    for (int i = 0; i < 10; i++) {
        int cindex = (i + 5) % 5;
        Rectangle rectangle = new Rectangle(100, 50, colors[cindex]);
        rectangles[i] = rectangle;
        hb.getChildren().add(rectangle);
    }

    sp.setPrefSize(115, 150);
    sp.setContent(hb);
    fileName.setOnMouseClicked((e) -> {
        scrollTo(rectangles[4]);
    });
    stage.show();
}