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(), 450, 250);

    ComboBox<String> myComboBox = new ComboBox<String>();
    myComboBox.getItems().addAll("A", "B", "C", "D", "E");
    myComboBox.setEditable(true);// ww  w.j  a v a  2 s .  c  o  m

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

}

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);/*from ww  w.j a  va  2  s .co m*/

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

    box.getChildren().add(line);

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

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

@Override
public void start(Stage stage) throws Exception {
    JFreeChart chart = ChartFactory.createBarChart("Random", "Category", "value", 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.  java 2 s . c  om
    stage.setHeight(390);
    stage.show();
}

From source file:Main.java

@Override
public void start(final Stage stage) throws Exception {
    Group rootGroup = new Group();
    Scene scene = new Scene(rootGroup, 800, 400);

    Text text1 = new Text(25, 25, "java2s.com");
    text1.setFill(Color.CHOCOLATE);
    text1.setFont(Font.font(java.awt.Font.SERIF, 25));
    rootGroup.getChildren().add(text1);/*from w  w  w. jav  a2s.co  m*/

    stage.setScene(scene);
    stage.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");

    VBox root = new VBox(10, imageView, saveBtn);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("");
    stage.show();//from   www . j a va  2  s. c  o m
}

From source file:Main.java

@Override
public void start(Stage stage) {
    ChoiceBox<String> choiceBox = new ChoiceBox<String>();
    choiceBox.setItems(cursors);// w  ww .jav a  2  s.  co m

    System.out.println(choiceBox.valueProperty());

    VBox box = new VBox();
    box.getChildren().add(choiceBox);
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {

    Group root = new Group();

    String imageSource = "http://yourImageURL";

    ImageView imageView = ImageViewBuilder.create().image(new Image(imageSource)).build();

    Group myGroup = GroupBuilder.create().children(imageView).build();

    root.getChildren().add(myGroup);//from w  w  w  .  j a va2 s  .c o m

    primaryStage.setScene(new Scene(root, 500, 400));
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Button b1 = new Button("Close");
    b1.setEffect(new DropShadow());

    Button b3 = new Button("Close");
    b3.setEffect(new DropShadow());
    b3.setRotate(30);/*from  w w  w . j  a v  a2  s.c om*/

    VBox root = new VBox();
    root.getChildren().addAll(b1, b3);

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Testing LayoutBounds");
    stage.show();

    System.out.println("b1=" + b1.getLayoutBounds());
    System.out.println("b3=" + b3.getLayoutBounds());
}

From source file:analyzer.code.FXMLAnalyzerController.java

@FXML
private void settingMunuItem() throws FileNotFoundException, IOException {
    FXMLLoader loader = new FXMLLoader(getClass().getResource("FXMLSetting.fxml"));
    try {//from ww w.j a  v a2 s  . c o m
        AnchorPane pane = (AnchorPane) loader.load();
        fxmlsc = loader.getController();
        fxmlsc.setAnalyzer(this);
        Scene scene = new Scene(pane);
        Stage stage = new Stage();
        stage.setScene(scene);
        stage.setTitle("??");
        stage.show();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

@Override
public void start(final Stage stage) throws Exception {
    Group rootGroup = new Group();
    Scene scene = new Scene(rootGroup, 800, 400);

    Text text1 = new Text(25, 25, "java2s.com");
    text1.setFill(Color.CHOCOLATE);
    text1.setFont(Font.font(java.awt.Font.MONOSPACED, 35));
    rootGroup.getChildren().add(text1);//from  w w  w .java2 s . c o m

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