Example usage for javafx.scene Group Group

List of usage examples for javafx.scene Group Group

Introduction

In this page you can find the example usage for javafx.scene Group Group.

Prototype

public Group() 

Source Link

Document

Constructs a group.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);//from w  ww.  ja  v a  2  s.  c  o m
    stage.setHeight(150);

    Button button = new Button("Hover Over Me");
    Tooltip toolTip = new Tooltip("Tooltip for Button");

    toolTip.setWrapText(true);

    button.setTooltip(toolTip);

    Tooltip.uninstall(button, toolTip);

    ((Group) scene.getRoot()).getChildren().add(button);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    Group group = new Group();

    Rectangle rect = new Rectangle(20, 20, 200, 200);

    rect.setArcHeight(15);// w  w  w . j  av  a  2  s  .c o m
    rect.setArcWidth(15);

    rect.setStroke(Color.BLACK);
    group.getChildren().add(rect);

    Scene scene = new Scene(group, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    final Group group = new Group();
    Scene scene = new Scene(group, 300, 150);
    stage.setScene(scene);/*from   w  ww  .  j  av  a2  s . co m*/
    stage.setTitle("Sample");
    Task<Integer> task = new Task<Integer>() {
        @Override
        protected Integer call() throws Exception {
            int iterations = 0;
            for (iterations = 0; iterations < 10; iterations++) {
                if (isCancelled()) {
                    break;
                }
                System.out.println("Iteration " + iterations);
            }
            return iterations;
        }

        @Override
        protected void succeeded() {
            super.succeeded();
            updateMessage("Done!");
        }

        @Override
        protected void cancelled() {
            super.cancelled();
            updateMessage("Cancelled!");
        }

        @Override
        protected void failed() {
            super.failed();
            updateMessage("Failed!");
        }
    };
    task.run();
    System.out.println(task.getMessage());

    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Text Fonts");

    Group g = new Group();
    Scene scene = new Scene(g, 550, 250);

    AudioClip plonkSound = new AudioClip("http://somehost/p.aiff");
    plonkSound.play();/*from   www .  ja v  a2s. co m*/

    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group group = new Group();
    Scene scene = new Scene(group);

    SplitMenuButton m = new SplitMenuButton();
    m.setText("Shutdown");
    m.getItems().addAll(new MenuItem("Logout"), new MenuItem("Sleep"));
    m.setOnAction(new EventHandler<ActionEvent>() {
        @Override// ww  w .j a v  a2s.c om
        public void handle(ActionEvent e) {
            System.out.println("Shutdown");
        }
    });

    group.getChildren().add(m);

    stage.setTitle("Welcome to JavaFX!");
    stage.setScene(scene);
    stage.sizeToScene();
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    Group group = new Group();

    Rectangle rect = new Rectangle(20, 20, 200, 200);

    rect.setStrokeWidth(2);//from  ww w.j  a v a  2s . c o m

    rect.setStroke(Color.RED);
    rect.setStrokeWidth(1.5);
    rect.getStrokeDashArray().addAll(3.0, 7.0, 3.0, 7.0);

    group.getChildren().add(rect);

    Scene scene = new Scene(group, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("ComboBoxSample");
    Scene scene = new Scene(new Group(), 450, 250);

    CubicCurve cubic = new CubicCurve();
    cubic.setStartX(0.0f);//w  ww.ja  v  a 2  s  .c  o  m
    cubic.setStartY(50.0f);
    cubic.setControlX1(25.0f);
    cubic.setControlY1(0.0f);
    cubic.setControlX2(75.0f);
    cubic.setControlY2(100.0f);
    cubic.setEndX(100.0f);
    cubic.setEndY(50.0f);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(cubic);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Drawing Lines");

    Group root = new Group();
    Scene scene = new Scene(root, 300, 150, Color.GRAY);

    Line redLine = new Line(10, 10, 200, 10);

    redLine.setStroke(Color.RED);
    redLine.setStrokeWidth(10);//from w  w w .j a  v a2s .  c  o  m
    redLine.setStrokeLineCap(StrokeLineCap.BUTT);

    redLine.getStrokeDashArray().addAll(15d, 5d, 15d, 15d, 20d);
    redLine.setStrokeDashOffset(10);

    root.getChildren().add(redLine);

    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);//w w w. ja v  a 2s .co  m
    stage.setHeight(500);
    Scene scene = new Scene(new Group());
    VBox root = new VBox();
    Hyperlink link = new Hyperlink("www.java2s.com");

    root.getChildren().addAll(link);
    scene.setRoot(root);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(final Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);/*from  w  w w  .j  a  va 2s .com*/
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox vbox = new VBox(8); // spacing = 8
    vbox.getChildren().addAll(new Button("Cut"), new Button("Copy"), new Button("Paste"));

    scene.setRoot(vbox);

    stage.setScene(scene);
    stage.show();
}