Example usage for javafx.stage Stage setScene

List of usage examples for javafx.stage Stage setScene

Introduction

In this page you can find the example usage for javafx.stage Stage setScene.

Prototype

@Override
final public void setScene(Scene value) 

Source Link

Document

Specify the scene to be used on this stage.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);//w w w. j a va  2 s  . com
    stage.setHeight(150);

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

    toolTip.setTextAlignment(TextAlignment.CENTER);

    button.setTooltip(toolTip);

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

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Text Fonts");
    Group root = new Group();
    Scene scene = new Scene(root, 550, 250, new Color(0, 0, 1, 1.0));

    Text text = new Text(50, 100, "JavaFX 2.0 from Java2s.com");
    Font sanSerif = Font.font("Dialog", 30);
    text.setFont(sanSerif);/* ww w.  ja  v  a  2s. c o m*/
    text.setFill(Color.RED);
    root.getChildren().add(text);

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250);
    Button btn = new Button();
    btn.setText("Hello World");
    btn.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent event) {
            System.out.println("Hello World");
        }/*from   w  w  w .  jav  a 2 s .com*/
    });
    root.getChildren().add(btn);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Text Fonts");
    Group root = new Group();
    Scene scene = new Scene(root, 550, 250, Color.web("0x0000FF", 1.0));

    Text text = new Text(50, 100, "JavaFX 2.0 from Java2s.com");
    Font sanSerif = Font.font("Dialog", 30);
    text.setFont(sanSerif);/*from  w w w. ja v a  2s  .co  m*/
    text.setFill(Color.RED);
    root.getChildren().add(text);

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

From source file:com.exalttech.trex.ui.UIBaseTest.java

@Override
public void start(Stage stage) throws Exception {
    TrexApp.setPrimaryStage(stage);/*from w w w . ja v a  2 s .  com*/
    AnchorPane page = (AnchorPane) FXMLLoader.load(getClass().getResource("/fxml/MainView.fxml"));
    Scene scene = new Scene(page);
    scene.getStylesheets().add(TrexApp.class.getResource("/styles/mainStyle.css").toExternalForm());
    stage.setScene(scene);
    stage.setTitle("TRex");
    stage.setResizable(true);
    stage.setMinWidth(1100);
    stage.setMinHeight(670);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    BorderPane root = new BorderPane();
    Scene scene = new Scene(root, 380, 150, Color.WHITE);

    GridPane gridpane = createGridPane();
    FlowPane topBanner = createTopBanner();

    root.setTop(topBanner);/*from  ww  w.  ja  v  a 2  s.  co m*/
    root.setCenter(gridpane);

    primaryStage.setTitle("Hello World!");
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);/*  w ww  . j  a va2  s.com*/
    stage.setHeight(150);

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

    System.out.println(toolTip.graphicTextGapProperty());

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

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Text Fonts");
    Group root = new Group();
    Scene scene = new Scene(root, 550, 250, Color.hsb(270, 1.0, 1.0, 1.0));

    Text text = new Text(50, 100, "JavaFX 2.0 from Java2s.com");
    Font sanSerif = Font.font("Dialog", 30);
    text.setFont(sanSerif);//from ww w  .ja v a  2  s  .com
    text.setFill(Color.RED);
    root.getChildren().add(text);

    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);

    Label title = new Label("Label 1");
    StackPane stackpane = new StackPane();
    StackPane.setAlignment(title, Pos.BOTTOM_CENTER);
    stackpane.getChildren().addAll(new Label("Label"), title);

    group.getChildren().add(stackpane);/*from  ww  w .  j  av  a 2s  .co  m*/

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

From source file:Main.java

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

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

    toolTip.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);

    button.setTooltip(toolTip);

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

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