List of usage examples for javafx.scene Scene getRoot
public final Parent getRoot()
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Tooltip Sample"); stage.setWidth(300);/*from w w w.j a v a2 s.c o m*/ stage.setHeight(150); ToolBar toolBar = new ToolBar(new Button("New"), new Button("Open"), new Button("Save"), new Separator(), new Button("Clean"), new Button("Compile"), new Button("Run"), new Separator(), new Button("Debug"), new Button("Profile")); ((Group) scene.getRoot()).getChildren().add(toolBar); 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 a 2 s .c om stage.setHeight(150); ToolBar toolBar = new ToolBar(new Button("New"), new Button("Open"), new Button("Save"), new Separator(), new Button("Clean"), new Button("Compile"), new Button("Run"), new Separator(), new Button("Debug"), new Button("Profile")); System.out.println(toolBar.getItems()); ((Group) scene.getRoot()).getChildren().add(toolBar); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); TextField notification = new TextField(); notification.setText("Label"); notification.clear();/*w w w. j av a2 s . c o m*/ GridPane grid = new GridPane(); grid.setVgap(4); grid.setHgap(10); grid.setPadding(new Insets(5, 5, 5, 5)); grid.add(new Label("To: "), 0, 0); grid.add(notification, 1, 0); Group root = (Group) scene.getRoot(); root.getChildren().add(grid); stage.setScene(scene); stage.show(); }
From source file:com.tesshu.subsonic.client.sample4_music_andmovie.StreamDownloadAndPlayApplication.java
@Override public void start(Stage stage) throws Exception { Search2Controller search2 = context.getBean(Search2Controller.class); StreamController streamController = context.getBean(StreamController.class); SuccessObserver callback = context.getBean(SuccessObserver.class); File tmpDirectory = new File(tmpPath); tmpDirectory.mkdir();//from ww w. j av a 2 s . com Optional<SearchResult2> result2 = search2.getOf("e", null, null, null, null, 1, null, null); result2.ifPresent(result -> { Optional<Child> maybeSong = result.getSongs().stream().findFirst(); maybeSong.ifPresent(song -> { streamController.stream(song, maxBitRate, format, null, null, null, null, (subject, inputStream, contentLength) -> { File dir = new File( tmpPath + "/" + song.getPath().replaceAll("([^/]+?)?$", StringUtils.EMPTY)); dir.mkdirs(); File file = new File(tmpPath + "/" + song.getPath().replaceAll("([^.]+?)?$", StringUtils.EMPTY) + format); try { BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(file)); BufferedInputStream reader = new BufferedInputStream(inputStream); byte buf[] = new byte[256]; int len; while ((len = reader.read(buf)) != -1) { fos.write(buf, 0, len); } fos.flush(); fos.close(); reader.close(); inputStream.close(); } catch (IOException e) { e.printStackTrace(); } String path = Paths.get(file.getPath()).toUri().toString(); Group root = new Group(); Scene scene = new Scene(root, 640, 480); Media media = new Media(path); MediaPlayer player = new MediaPlayer(media); MediaView view = new MediaView(player); ((Group) scene.getRoot()).getChildren().add(view); stage.setScene(scene); stage.show(); player.play(); }, callback); }); }); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Sample"); stage.setWidth(300);// w w w. ja v a2s. c o m stage.setHeight(190); VBox vbox = new VBox(); vbox.setLayoutX(20); vbox.setLayoutY(20); Rectangle rect = new Rectangle(50, 50, Color.RED); rect.getTransforms().add(new Rotate(45, 0, 0)); // vbox.getChildren().add(rect); vbox.setSpacing(10); ((Group) scene.getRoot()).getChildren().add(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Label Sample"); stage.setWidth(400);//from w ww . ja v a2s .c om stage.setHeight(180); HBox hbox = new HBox(); Image image = new Image(getClass().getResourceAsStream("labels.jpg")); Label label1 = new Label("Search"); label1.setGraphic(new ImageView(image)); hbox.setSpacing(10); hbox.getChildren().add((label1)); ((Group) scene.getRoot()).getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { stage.setTitle("ComboBoxSample"); Scene scene = new Scene(new Group(), 450, 250); TextField notification = new TextField(); notification.setText("Label"); notification.clear();/* w w w . j a v a 2 s .c o m*/ GridPane grid = new GridPane(); grid.setVgap(4); grid.setHgap(10); grid.setPadding(new Insets(5, 5, 5, 5)); grid.add(new Label("To: "), 0, 0); grid.add(notification, 1, 0); Group root = (Group) scene.getRoot(); root.getChildren().add(grid); stage.setScene(scene); stage.show(); }
From source file:Main.java
License:asdf
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); TilePane tile = new TilePane(Orientation.VERTICAL, 0.5, 0.5); tile.setHgap(8);//from ww w. j a v a2 s . co m tile.setPrefColumns(4); for (int i = 0; i < 20; i++) { tile.getChildren().add(new CheckBox("asdf")); } HBox hbox = new HBox(10); hbox.setPadding(new Insets(20, 0, 0, 20)); hbox.getChildren().setAll(tile); Group root = (Group) scene.getRoot(); root.getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); TilePane tile = new TilePane(); tile.setHgap(8);/*from w w w . j a va 2s .c o m*/ tile.setPrefColumns(4); for (int i = 0; i < 20; i++) { tile.getChildren().add(new CheckBox("CheckBox")); } tile.requestLayout(); HBox hbox = new HBox(10); hbox.setPadding(new Insets(20, 0, 0, 20)); hbox.getChildren().setAll(tile); Group root = (Group) scene.getRoot(); root.getChildren().add(hbox); 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);// ww w .j a v a 2s. c om stage.setHeight(150); final CheckBox cb = new CheckBox(); cb.setText("checkBox"); cb.selectedProperty().addListener(new ChangeListener<Boolean>() { public void changed(ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) { System.out.println(cb.isSelected()); } }); ((Group) scene.getRoot()).getChildren().add(cb); stage.setScene(scene); stage.show(); }