List of usage examples for javafx.scene.control Button Button
public Button(String text)
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(); Button button1 = new Button("Add"); Button button2 = new Button("Remove"); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); hbox.setPrefWidth(400);/*from w ww . ja v a 2 s . co m*/ System.out.println(HBox.getMargin(button1)); root.getChildren().add(hbox); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(); Button button1 = new Button("Add"); Button button2 = new Button("Remove"); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); hbox.setPrefWidth(400);// w w w . j ava 2 s . c o m System.out.println(HBox.getHgrow(button1)); root.getChildren().add(hbox); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(); Button button1 = new Button("Add"); Button button2 = new Button("Remove"); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); hbox.setPrefWidth(400);//from ww w . j a v a 2 s .c o m System.out.println(hbox.isFillHeight()); root.getChildren().add(hbox); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(); Button button1 = new Button("Add"); Button button2 = new Button("Remove"); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); hbox.setPrefWidth(400);//from w ww . j av a2s . c om System.out.println(hbox.getSpacing()); root.getChildren().add(hbox); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(300);/*from w ww . j ava2s . co m*/ stage.setHeight(150); ToolBar toolBar = new ToolBar(); toolBar.getItems().add(new Button("New")); toolBar.getItems().add(new Button("Open")); toolBar.getItems().add(new Button("Save")); toolBar.getItems().add(new Separator()); toolBar.getItems().add(new Button("Clean")); toolBar.getItems().add(new Button("Compile")); toolBar.getItems().add(new Button("Run")); toolBar.getItems().add(new Separator()); toolBar.getItems().add(new Button("Debug")); toolBar.getItems().add(new Button("Profile")); toolBar.setOrientation(Orientation.HORIZONTAL); System.out.println(toolBar.orientationProperty()); ((Group) scene.getRoot()).getChildren().add(toolBar); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("BorderPane Test"); //Creating StackPane StackPane sp = new StackPane(); //// w w w . j av a 2 s. co m Label lbl = new Label("JavaFX 2 StackPane"); sp.getChildren().add(lbl); Button btn = new Button("Button"); sp.getChildren().add(btn); //Adding StackPane to the scene Scene scene = new Scene(sp, 300, 200); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(300);/*from ww w . jav a 2 s .c om*/ stage.setHeight(150); Button button = new Button("Hover Over Me"); Tooltip toolTip = new Tooltip(); toolTip.setContentDisplay(ContentDisplay.BOTTOM); button.setTooltip(toolTip); ((Group) scene.getRoot()).getChildren().add(button); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(); Button button1 = new Button("Add"); Button button2 = new Button("Remove"); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); hbox.setPrefWidth(400);//from w w w . j a v a 2 s.c om hbox.setAlignment(Pos.BASELINE_CENTER); root.getChildren().add(hbox); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle(""); Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(); Button button1 = new Button("Add "); Button button2 = new Button("Remove "); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); root.getChildren().add(hbox);/*from w ww . j a v a2 s .c o m*/ primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); HBox hbox = new HBox(); Button button1 = new Button("Add"); Button button2 = new Button("Remove"); HBox.setHgrow(button1, Priority.ALWAYS); HBox.setHgrow(button2, Priority.ALWAYS); button1.setMaxWidth(Double.MAX_VALUE); button2.setMaxWidth(Double.MAX_VALUE); hbox.getChildren().addAll(button1, button2); hbox.setPrefWidth(400);//from ww w .ja va2 s .c om hbox.setFillHeight(true); root.getChildren().add(hbox); primaryStage.setScene(scene); primaryStage.show(); }