Example usage for javafx.stage Stage show

List of usage examples for javafx.stage Stage show

Introduction

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

Prototype

@Override
public final void show() 

Source Link

Usage

From source file:ipat_fx.IPAT_FX.java

@Override
public void start(Stage stage) throws Exception {
    String contextPath = System.getProperty("user.dir") + "/web/";
    File logFile = new File(contextPath + "/log/log4j-IPAT.log");
    System.setProperty("rootPath", logFile.getAbsolutePath());

    Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);/*  ww w .  j a  v  a 2  s.  co m*/
    stage.show();
    stage.setOnHiding((WindowEvent event) -> {
        Platform.runLater(() -> {
            File src = new File(contextPath + "/Client Data");
            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
            Date date = new Date();
            File dest = new File(contextPath + "/Saves/Ipat_" + dateFormat.format(date));
            if (!dest.exists()) {
                dest.mkdirs();
            }
            try {
                FileUtils.copyDirectory(src, dest);
            } catch (IOException ex) {
                Logger.getLogger(IPAT_FX.class.getName()).log(Level.SEVERE, null, ex);
            }
            System.exit(0);
        });
    });
}

From source file:Main.java

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

    VBox root = new VBox();

    Path path = new Path();
    path.getElements().add(new MoveTo(50.0f, 0.0f));
    path.getElements().add(new VLineTo(50.0f));

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

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    AreaChart areaChart = new AreaChart(xAxis, yAxis, getChartData());

    areaChart.setTitle("speculations");
    primaryStage.setTitle("AreaChart example");

    StackPane root = new StackPane();
    root.getChildren().add(areaChart);//  w w w  .  j  a  va 2 s.c  om
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    String imagePath = "resources/picture/yourImage.jpg";
    Image image = new Image(imagePath);

    ImageView imageView = new ImageView(image);

    Button saveBtn = new Button("Save Image");
    saveBtn.setOnAction(e -> saveToFile(image));

    VBox root = new VBox(10, imageView, saveBtn);
    Scene scene = new Scene(root);
    stage.setScene(scene);//from   w  ww  .  j a v  a2s .  c  o m
    stage.setTitle("");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    vb.setId("root");

    WebView browser = new WebView();
    WebEngine engine = browser.getEngine();
    String url = "http://java2s.com/";
    engine.load(url);// w  w  w  .j  av a 2s.c om

    vb.setPadding(new Insets(30, 50, 50, 50));
    vb.setSpacing(10);
    vb.setAlignment(Pos.CENTER);
    vb.getChildren().addAll(browser);

    Scene scene = new Scene(vb);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("BorderPane Test");

    //Creating StackPane
    StackPane sp = new StackPane();

    ///*from ww  w.  j a v  a 2 s .  c  o m*/
    Label lbl = new Label("JavaFX 2 StackPane");
    sp.getChildren().add(lbl);
    Button btn = new Button("Button");
    sp.getChildren().add(btn);

    //Adding StackPane to the scene
    Scene scene = new Scene(sp, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Button btn = new Button("A big button");

    Rectangle rect = new Rectangle(100, 50);
    rect.setFill(Color.WHITE);//from w w w  .  ja v a2s  .  c  o  m
    rect.setStrokeWidth(1);
    rect.setStroke(Color.BLACK);

    HBox root = new HBox();
    root.setSpacing(20);
    root.getChildren().addAll(btn, rect);

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Resizable Nodes");
    stage.show();

    System.out.println("btn.isResizable(): " + btn.isResizable());
    System.out.println("rect.isResizable(): " + rect.isResizable());
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);//w ww .j  ava2s.  co  m
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox root = new VBox();

    final HTMLEditor htmlEditor = new HTMLEditor();
    htmlEditor.setPrefHeight(600);
    htmlEditor.setHtmlText(INITIAL_TEXT);

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

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Tooltip Sample");
    stage.setWidth(300);// w ww.ja va2  s  .c  om
    stage.setHeight(150);
    final CheckBox cb = new CheckBox("checkBox");
    final Tooltip tooltip = new Tooltip("$ tooltip");
    tooltip.setFont(new Font("Arial", 16));
    cb.setTooltip(tooltip);

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

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);//from www.  j  a  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);
    System.out.println(toolTip.textProperty());

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

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