private VBox createStackedTitledPanes() { final VBox stackedTitledPanes = new VBox(); stackedTitledPanes.getChildren().setAll( new TitledPane("Pane 1", contentNode1), new TitledPane("Pane 2", contentNode2), new TitledPane("Pane 3", contentNode3) ); ((TitledPane) stackedTitledPanes.getChildren().get(0)).setExpanded(true); return stackedTitledPanes; }
primaryStage.setTitle("Extension Filter Example"); final Label fileLabel = new Label(); Button btn = new Button("Open FileChooser"); btn.setOnAction(new EventHandler<ActionEvent>() { VBox vBox = new VBox(30); vBox.getChildren().addAll(fileLabel, btn); vBox.setAlignment(Pos.BASELINE_CENTER); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show();
final Label response = new Label(); final ImageView imageView = new ImageView( new Image("http://icons.iconarchive.com/icons/gianni-polito/colobrush/128/software-emule-icon.png") final VBox layout = new VBox(10); layout.setPrefWidth(300); layout.setAlignment(Pos.CENTER); layout.getChildren().addAll(button, response); layout.setStyle("-fx-background-color: cornsilk; -fx-padding: 20; -fx-font-size: 20;"); stage.setScene(new Scene(layout));
); final Label currentRaceStage = new Label(); currentRaceStage.textProperty().bind( taskMonitor.currentTaskNameProperty() final Button startButton = new Button("Start Race"); startButton.disableProperty().bind(taskMonitor.idleProperty().not()); startButton.setOnAction(new EventHandler<ActionEvent>() { final VBox layout = new VBox(10); layout.getChildren().setAll( raceProgress, startButton
VBox vboxForButtons = new VBox(); for(int i=0; i<10; i++){ Button btnNumber = new Button(); btnNumber.setText(String.valueOf(i)); btnNumber.setOnAction((ActionEvent)->{ System.out.println(btnNumber.getText()); }); vboxForButtons.getChildren().add(btnNumber); }
pane.setPadding(new Insets(18)); VBox container = new VBox(); container.getChildren().add(pane); container.getChildren().add(tabs); dialog.setScene(customScene); final EventHandler<KeyEvent> keyEventListener = key -> { switch (key.getCode()) {
VBox buttonHolder = new VBox(); Button button = new Button(...); buttonHolder.getChildren().add(button); // repeat as necessary... buttonHolder.setDisable(true); // all buttons in the VBox will now be disbaled
@Override public void start(Stage stage) throws Exception { final VBox pane = new VBox(); pane.setSpacing(30); pane.setStyle("-fx-background-color:#EEE; -fx-padding: 40;"); ToggleButton button = new ToggleButton("JavaFx Toggle"); pane.getChildren().add(button); JFXToggleButton toggleButton = new JFXToggleButton(); toggleButton.setText("New Skin"); pane.getChildren().add(toggleButton); JFXToggleNode node = new JFXToggleNode(); final GlyphIcon heartIcon = GlyphsBuilder.create(FontAwesomeIconView.class) .glyph(FontAwesomeIcon.HEART) .build(); heartIcon.setStyle("-fx-padding: 10"); node.setGraphic(heartIcon); pane.getChildren().add(node); final Scene scene = new Scene(pane, 600, 400, Color.valueOf("#EEE")); stage.setTitle("JFX Toggle Button Demo "); scene.getStylesheets() .add(ToggleButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setScene(scene); stage.setResizable(false); stage.show(); }
public class CustomGroup extends Group { private VBox contentPane = new VBox(); public CustomGroup() { getChildren().add(contentPane); contentPane.getChildren().add(new Label("First Label")); contentPane.getChildren().add(new Label("Second Label")); } public void setItems(Node...nodes) { contentPane.getChildren().addAll(nodes); } public ObservableList<Node> getItems() { return contentPane.getChildren(); } }
Button b = new Button(); VBox box = new VBox(); box.getChildren().addAll(new Label("line1"), new Label("line2")); b.setGraphic(box);
VBox vbox = new VBox(); vbox.getChildren().add(new MyComponent());
primaryStage.setTitle("AnimationTest"); Pane pane = new Pane(); Rectangle rect = new Rectangle(0,0,100,100); pane.getChildren().add(rect); TranslateTransition transition =new TranslateTransition(Duration.millis(1000),rect); transition.setByX(100); Button button = new Button("StartAnimation"); button.setOnAction((e)->{ transition.play(); }); VBox layout = new VBox(); layout.getChildren().addAll(pane, button); Scene scene = new Scene(layout, 600, 600); primaryStage.setScene(scene); primaryStage.show();
VBox vBox = new VBox(); Button btn1 = new Button("Short"); Button btn2 = new Button("Super Long Button"); btn1.setMaxWidth(Double.MAX_VALUE); btn2.setMaxWidth(Double.MAX_VALUE); vBox.getChildren().addAll(btn1, btn2);
Button configure = new Button("Configure"); changeBackgroundOnHoverUsingBinding(configure); Button update = new Button("Update"); changeBackgroundOnHoverUsingEvents(update); VBox layout = new VBox(10); layout.setAlignment(Pos.CENTER); layout.setStyle("-fx-padding: 10;"); layout.getChildren().addAll(configure, update); stage.setScene(new Scene(layout)); stage.show();
public class SecondStage extends Stage { Label x = new Label("Second stage"); VBox y = new VBox(); SecondStage(){ y.getChildren().add(x); this.setScene(new Scene(y, 300, 300)); this.show(); } }
Label header = new Label("A Prideful Header"); header.getStyleClass().addAll("header"); Label footer = new Label("a humble footer"); footer.getStyleClass().addAll("footer"); VBox box = new VBox(); box.getChildren().addAll(header,footer); Button button = new Button(); button.setGraphic(box);
VBox headerPanel = new VBox(); headerPanel.getStyleClass().add("month-year-pane"); headerPanel.setBackground(new Background(new BackgroundFill(this.datePicker.getDefaultColor(), Insets.EMPTY))); headerPanel.setPadding(new Insets(12, 24, 12, 24)); headerPanel.getChildren().add(yearLabelContainer); headerPanel.getChildren().add(selectedDateContainer); return headerPanel;
Popup popup = new Popup(); VBox vBox = new VBox(); for (int i = 0; i < 4; i++) { Button item = new Button("item " + i); item.setOnAction(...); vBox.getChildren().add(item); } ScrollPane scrollPane = new ScrollPane(vBox); scrollPane.setMaxHeight(500);//Adjust max height of the popup here scrollPane.setMaxWidth(200);//Adjust max width of the popup here popup.getContent().add(scrollPane); popup.show(rootWindow);
VBox vBox = new VBox(); vBox.setPrefWidth(100); Button btn1 = new Button("Short"); Button btn2 = new Button("Super Long Button"); btn1.setMinWidth(vBox.getPrefWidth()); btn2.setMinWidth(vBox.getPrefWidth()); vBox.getChildren().addAll(btn1, btn2);
VBox layout = new VBox(); layout.getChildren().addAll( nav, webview stage.setScene(scene); stage.show();