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 group = new Group(); Button button = new Button("Button"); button.setStyle("-fx-padding: 10 20 10 20;"); group.getChildren().add(button);//from w ww . j av a 2 s. c o m Scene scene = new Scene(group, 300, 200); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Button b1 = new Button("B1"); Button b2 = new Button("B2"); Button b3 = new Button("B3"); Button visibleBtn = new Button("Make Invisible"); visibleBtn.setOnAction(e -> b2.setVisible(!b2.isVisible())); visibleBtn.textProperty().bind(new When(b2.visibleProperty()).then("Invisible").otherwise("Visible")); b2.managedProperty().bind(b2.visibleProperty()); HBox root = new HBox(); root.getChildren().addAll(visibleBtn, b1, b2, b3); Scene scene = new Scene(root); stage.setScene(scene);//from w w w . j a v a 2 s.c o m stage.setTitle(""); stage.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);/* www. j a v a 2 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:Main.java
@Override public void start(Stage stage) { Button btn = new Button("Hello JavaFX!"); HBox root = new HBox(); root.getChildren().addAll(btn);// w ww. j av a2 s .c om Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("Sizes of a Node"); stage.show(); btn.setWrapText(true); btn.setPrefWidth(80); stage.sizeToScene(); System.out.println("btn.getContentBias() = " + btn.getContentBias()); System.out.println( "btn.getPrefWidth() = " + btn.getPrefWidth() + ", btn.getPrefHeight() = " + btn.getPrefHeight()); System.out.println( "btn.getMinWidth() = " + btn.getMinWidth() + ", btn.getMinHeight() = " + btn.getMinHeight()); System.out.println( "btn.getMaxWidth() = " + btn.getMaxWidth() + ", btn.getMaxHeight() = " + btn.getMaxHeight()); double prefWidth = btn.prefWidth(-1); System.out.println( "btn.prefWidth(-1) = " + prefWidth + ", btn.prefHeight(prefWidth) = " + btn.prefHeight(prefWidth)); double minWidth = btn.minWidth(-1); System.out.println( "btn.minWidth(-1) = " + minWidth + ", btn.minHeight(minWidth) = " + btn.minHeight(minWidth)); double maxWidth = btn.maxWidth(-1); System.out.println( "btn.maxWidth(-1) = " + maxWidth + ", btn.maxHeight(maxWidth) = " + btn.maxHeight(maxWidth)); System.out.println("btn.getWidth() = " + btn.getWidth() + ", btn.getHeight() = " + btn.getHeight()); }
From source file:Main.java
@Override public void start(Stage stage) { Button b1 = new Button("Close"); b1.setEffect(new DropShadow()); Button b2 = new Button("Close"); Button b3 = new Button("Close"); b3.setEffect(new DropShadow()); b3.setRotate(30);//from w w w. ja va2 s . c o m Button b4 = new Button("Close"); VBox root = new VBox(); root.getChildren().addAll(b1, b2, b3, b4); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("Testing LayoutBounds"); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Button btn = new Button("A big button"); Rectangle rect = new Rectangle(100, 50); rect.setFill(Color.WHITE);/*from w w w. j a va2s . c o m*/ rect.setStrokeWidth(1); rect.setStroke(Color.BLACK); HBox root = new HBox(); root.setSpacing(20); root.getChildren().addAll(btn, rect); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("Resizable Nodes"); stage.show(); System.out.println("btn.isResizable(): " + btn.isResizable()); System.out.println("rect.isResizable(): " + rect.isResizable()); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(300);// w w w .ja va 2 s. c om stage.setHeight(150); Button button = new Button("Hover Over Me"); Tooltip toolTip = new Tooltip("Tooltip for Button"); System.out.println(toolTip.getGraphicTextGap()); button.setTooltip(toolTip); ((Group) scene.getRoot()).getChildren().add(button); 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);/*from www. ja v a2s. c om*/ stage.setHeight(150); Button button = new Button("Hover Over Me"); Tooltip toolTip = new Tooltip("Tooltip for Button"); System.out.println(toolTip.getContentDisplay()); button.setTooltip(toolTip); ((Group) scene.getRoot()).getChildren().add(button); 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);//from ww w .j a v a 2 s . c om stage.setHeight(150); Button button = new Button("Hover Over Me"); Tooltip toolTip = new Tooltip("Tooltip for Button"); System.out.println(toolTip.graphicProperty()); button.setTooltip(toolTip); ((Group) scene.getRoot()).getChildren().add(button); 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);/* www . j a va 2 s . c o m*/ stage.setHeight(150); Button button = new Button("Hover Over Me"); Tooltip toolTip = new Tooltip("Tooltip for Button"); System.out.println(toolTip.contentDisplayProperty()); button.setTooltip(toolTip); ((Group) scene.getRoot()).getChildren().add(button); stage.setScene(scene); stage.show(); }