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) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);// w ww .j  a  va  2  s  .c o  m

    Line line = new Line();
    line.setStartX(0.0f);
    line.setStartY(0.0f);
    line.setEndX(100.0f);
    line.setEndY(100.0f);

    line.setStartY(0.4);

    box.getChildren().add(line);

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    FlowPane flowPane = new FlowPane(4, 3);
    flowPane.setPrefWrapLength(210);/*  ww w  . j  a  v  a  2 s.c  o m*/
    Button btn = new Button();

    for (int i = 0; i < 8; i++) {
        btn = new Button("Button");
        btn.setPrefSize(100, 50);
        flowPane.getChildren().add(btn);
    }
    Scene scene = new Scene(flowPane);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    PieChart pieChart = new PieChart();
    pieChart.setData(getChartData());/*from   ww  w  .j a va  2  s .  co  m*/
    pieChart.setTitle("Title");
    pieChart.setLegendSide(Side.LEFT);
    pieChart.setClockwise(false);
    pieChart.setLabelsVisible(false);

    StackPane root = new StackPane();
    root.getChildren().add(pieChart);
    primaryStage.setScene(new Scene(root, 300, 250));
    primaryStage.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);//ww  w  .j  av  a2 s  . c om
    stage.setHeight(150);

    Rectangle rect = new Rectangle(0, 0, 100, 100);
    Tooltip t = new Tooltip("A Square");
    Tooltip.install(rect, t);

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

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    LineChart lineChart = new LineChart(xAxis, yAxis);
    lineChart.setData(getChartData());/*w  ww  .  ja v a 2  s .  c om*/
    lineChart.setTitle("Chart");

    StackPane root = new StackPane();
    root.getChildren().add(lineChart);
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}

From source file:account.management.controller.ViewSalaryVoucherController.java

/**
 * Initializes the controller class./*from www.  j  a v  a  2s  .co  m*/
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    this.voucher_no.setCellValueFactory(new PropertyValueFactory("id"));
    this.date.setCellValueFactory(new PropertyValueFactory("date"));
    this.section.setCellValueFactory(new PropertyValueFactory("section"));
    this.name.setCellValueFactory(new PropertyValueFactory("name"));
    this.basis.setCellValueFactory(new PropertyValueFactory("basis"));
    this.amount.setCellValueFactory(new PropertyValueFactory("total"));

    final ContextMenu contextMenu = new ContextMenu();
    MenuItem item1 = new MenuItem("    View                  ");
    item1.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent e) {
            Data.salaryVoucher = table.getSelectionModel().getSelectedItem();

            try {
                Parent root = FXMLLoader
                        .load(getClass().getResource(MetaData.viewPath + "EditSalaryVoucher.fxml"));
                Scene scene = new Scene(root);
                Stage stage = new Stage();
                scene.setRoot(root);
                stage.setResizable(false);
                stage.setTitle("Salary Voucher");
                stage.setScene(scene);
                stage.showAndWait();
                int index = table.getSelectionModel().getSelectedIndex();
                getData();

            } catch (IOException ex) {
                Logger.getLogger(ViewSalaryVoucherController.class.getName()).log(Level.SEVERE, null, ex);
            }

        }
    });
    contextMenu.getItems().addAll(item1);
    this.table.setContextMenu(contextMenu);

}

From source file:Main.java

@Override
public void start(final Stage stage) {
    stage.setWidth(500);//from   w  ww . j a  va 2 s  .  c om
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox root = new VBox();
    CategoryAxis lineXAxis = new CategoryAxis(getData());

    System.out.println(lineXAxis.getEndMargin());

    root.getChildren().addAll(lineXAxis);
    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.setWidth(300);/*  w w  w.ja v a2  s.c  o  m*/
    stage.setHeight(150);

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

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

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

From source file:net.sf.mzmine.chartbasics.gui.javafx.demo.FXChartGestureDemo.java

@Override
public void start(Stage stage) throws Exception {
    XYDataset dataset = createDataset();
    JFreeChart chart = ChartFactory.createXYLineChart("Random", "i", "r", createDataset());
    EChartViewer canvas = new EChartViewer(chart);
    StackPane stackPane = new StackPane();
    stackPane.getChildren().add(canvas);
    stage.setScene(new Scene(stackPane));
    stage.setTitle("Chart gesture demo");
    stage.setWidth(700);/*from  w w  w. ja  v  a 2 s  . co  m*/
    stage.setHeight(390);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    PieChart pieChart = new PieChart();
    pieChart.setData(getChartData());//from  w  w  w . j av a2  s  . c  o m

    pieChart.setTitle("Title");
    pieChart.setLegendSide(Side.LEFT);
    pieChart.setClockwise(false);
    pieChart.setLabelsVisible(false);

    StackPane root = new StackPane();
    root.getChildren().add(pieChart);
    primaryStage.setScene(new Scene(root, 300, 250));
    primaryStage.show();

    pieChart.setStartAngle(5);
}