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

The following examples show how to use javafx.scene.paint.Color#ALICEBLUE . 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();
}
 
Example 2
Source File: JavaFxHtmlToolkit.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Object initHtmlComponent(JComponent c, Consumer<String> titleDisplayer) {
    JFXPanel p = (JFXPanel) c;
    Platform.setImplicitExit(false);
    WebView webView = new WebView();
    BorderPane bp = new BorderPane();
    Scene scene = new Scene(bp, Color.ALICEBLUE);

    class X implements ChangeListener<String>, Runnable {

        private String title;

        public X() {
            super();
        }

        @Override
        public void changed(ObservableValue<? extends String> ov, String t, String t1) {
            title = webView.getEngine().getTitle();
            EventQueue.invokeLater(this);
        }

        @Override
        public void run() {
            if (title != null) {
                titleDisplayer.accept(title);
            }
        }
    }
    final X x = new X();
    webView.getEngine().titleProperty().addListener(x);
    HtmlToolkit.getDefault().execute(x);
    bp.setCenter(webView);
    p.setScene(scene);
    return webView;
}