List of usage examples for javafx.scene.layout StackPane getChildren
@Override
public ObservableList<Node> getChildren()
From source file:Testing.TestMain.java
public static void treeSample(Stage stage, Collection root) { TreeItem<String> rootItem = new TreeItem<String>("D:\\"); rootItem.setExpanded(true);//from w w w . j ava 2 s . c om for (Iterator it = root.iterator(); it.hasNext();) { Object i = it.next(); TreeItem<String> item = new TreeItem<String>(i.toString()); rootItem.getChildren().add(item); } /* for (int i = 1; i < 6; i++) { TreeItem<String> item = new TreeItem<String>("Message" + i); rootItem.getChildren().add(item); }*/ TreeView<String> tree = new TreeView<String>(rootItem); StackPane rootpane = new StackPane(); rootpane.getChildren().add(tree); stage.setScene(new Scene(rootpane, 300, 250)); stage.show(); }
From source file:Main.java
public static void executeWithProgressDialogInBackground(final Runnable runnable, final StackPane target, final String text) { Thread th = new Thread() { @Override//from w ww . ja v a2 s . c om public void run() { final Node progressIndicator = createProgressIndicator(); final Label label = new Label(text); try { Platform.runLater(new Runnable() { @Override public void run() { target.getChildren().add(progressIndicator); label.setWrapText(true); target.getChildren().add(label); } }); runnable.run(); } finally { Platform.runLater(new Runnable() { @Override public void run() { target.getChildren().remove(progressIndicator); target.getChildren().remove(label); } }); } } }; th.setDaemon(true); th.start(); }
From source file:gov.va.isaac.gui.util.ErrorMarkerUtils.java
/** * Setup an 'INFORMATION' info marker on the component. Automatically displays anytime that the initialControl is disabled. * Put the initial control in the provided stack pane *//*w w w .j a v a 2s . c o m*/ public static Node setupDisabledInfoMarker(Control initialControl, StackPane stackPane, ObservableStringValue reasonWhyControlDisabled) { ImageView information = Images.INFORMATION.createImageView(); information.visibleProperty().bind(initialControl.disabledProperty()); Tooltip tooltip = new Tooltip(); tooltip.textProperty().bind(reasonWhyControlDisabled); Tooltip.install(information, tooltip); tooltip.setAutoHide(true); information.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { tooltip.show(information, event.getScreenX(), event.getScreenY()); } }); stackPane.setMaxWidth(Double.MAX_VALUE); stackPane.getChildren().add(initialControl); StackPane.setAlignment(initialControl, Pos.CENTER_LEFT); stackPane.getChildren().add(information); if (initialControl instanceof Button) { StackPane.setAlignment(information, Pos.CENTER); } else if (initialControl instanceof CheckBox) { StackPane.setAlignment(information, Pos.CENTER_LEFT); StackPane.setMargin(information, new Insets(0, 0, 0, 1)); } else { StackPane.setAlignment(information, Pos.CENTER_RIGHT); double insetFromRight = (initialControl instanceof ComboBox ? 30.0 : 5.0); StackPane.setMargin(information, new Insets(0.0, insetFromRight, 0.0, 0.0)); } return stackPane; }
From source file:Main.java
@Override public void start(Stage primaryStage) { PieChart pieChart = new PieChart(); pieChart.setData(getChartData());/*from w ww . ja va 2s. c o m*/ primaryStage.setTitle("PieChart"); StackPane root = new StackPane(); root.getChildren().add(pieChart); primaryStage.setScene(new Scene(root, 400, 250)); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Group group = new Group(); Scene scene = new Scene(group); StackPane stack = new StackPane(); stack.getChildren().addAll(new Rectangle(100, 100, Color.BLUE)); group.getChildren().add(stack);//w w w . j a va2s. c om stage.setTitle("Welcome to JavaFX!"); stage.setScene(scene); stage.sizeToScene(); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { TreeItem<String> rootItem = new TreeItem<>("Root"); rootItem.setExpanded(true);/*from w ww . j a v a 2 s.c om*/ TreeItem<String> item = new TreeItem<>("A"); rootItem.getChildren().add(item); item = new TreeItem<>("B"); rootItem.getChildren().add(item); TreeView<String> tree = new TreeView<>(rootItem); StackPane root = new StackPane(); root.getChildren().add(tree); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { TableView table = new TableView(); table.setEditable(true);//from w w w .j av a 2s. c o m TableColumn firstNameCol = new TableColumn("First Name"); TableColumn lastNameCol = new TableColumn("Last Name"); TableColumn emailCol = new TableColumn("Email"); table.getColumns().addAll(firstNameCol, lastNameCol, emailCol); emailCol.setVisible(false); StackPane root = new StackPane(); root.getChildren().add(table); primaryStage.setScene(new Scene(root, 200, 250)); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Hello World!"); Button btn = new Button(); btn.setText("Say 'Hello World'"); btn.setOnAction(new EventHandler<ActionEvent>() { @Override//from w ww .j a va 2s . co m public void handle(ActionEvent event) { System.out.println("Hello World!"); } }); StackPane root = new StackPane(); root.getChildren().add(btn); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { PieChart pieChart = new PieChart(); pieChart.setData(getChartData());/* w ww . 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 primaryStage) { ObservableList<String> data = FXCollections.observableArrayList(); ListView<String> listView = new ListView<String>(data); listView.setPrefSize(200, 250);//www . j av a 2s . c om data.addAll("A", "B", "C", "D", "E"); listView.setItems(data); listView.getSelectionModel().selectedItemProperty() .addListener((ObservableValue<? extends String> ov, String old_val, String new_val) -> { System.out.println(new_val); }); StackPane root = new StackPane(); root.getChildren().add(listView); primaryStage.setScene(new Scene(root, 200, 250)); primaryStage.show(); }