List of usage examples for javafx.scene.layout HBox HBox
public HBox()
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 v a 2 s . co 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) { 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 ww.ja va2 s .co m stage.setTitle(""); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Borders"); Group root = new Group(); Scene scene = new Scene(root, 600, 330, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);// w ww. ja va 2s . co m gridpane.setVgap(10); final String cssDefault = "-fx-border-color: blue;\n" + "-fx-border-insets: 5;\n" + "-fx-border-width: 3;\n" + "-fx-border-style: dashed;\n"; final HBox pictureRegion = new HBox(); pictureRegion.setStyle(cssDefault); gridpane.add(pictureRegion, 1, 1, 10, 10); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { TextField fName = new TextField(); TextField lName = new TextField(); TextField salary = new TextField(); marker = new Circle(5); marker.setManaged(false);//ww w . ja v a2s . c o m marker.setFill(Color.RED); marker.setMouseTransparent(true); HBox hb1 = new HBox(); HBox hb2 = new HBox(); HBox hb3 = new HBox(); hb1.getChildren().addAll(new Label("First Name:"), fName); hb2.getChildren().addAll(new Label("Last Name:"), lName); hb3.getChildren().addAll(new Label("Salary:"), salary); VBox root = new VBox(); root.getChildren().addAll(hb1, hb2, hb3, marker); Scene scene = new Scene(root); scene.focusOwnerProperty().addListener((prop, oldNode, newNode) -> placeMarker(newNode)); stage.setScene(scene); stage.setTitle(""); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle(""); stage.setWidth(230);//from w ww . j av a 2s.c o m stage.setHeight(120); Path path = new Path(); path.getElements().add(new MoveTo(0.0f, 50.0f)); path.getElements().add(new LineTo(100.0f, 100.0f)); VBox vbox = new VBox(); vbox.getChildren().addAll(path); vbox.setSpacing(5); HBox root = new HBox(); root.getChildren().add(vbox); root.setSpacing(40); root.setPadding(new Insets(20, 10, 10, 20)); ((Group) scene.getRoot()).getChildren().add(root); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Checkbox Sample"); stage.setWidth(230);// ww w. j a v a2s .co m stage.setHeight(120); Path path = new Path(); path.getElements().add(new MoveTo(0.0f, 50.0f)); path.getElements().add(new LineTo(100.0f, 100.0f)); VBox vbox = new VBox(); vbox.getChildren().addAll(path); vbox.setSpacing(5); HBox root = new HBox(); root.getChildren().add(vbox); root.setSpacing(40); root.setPadding(new Insets(20, 10, 10, 20)); ((Group) scene.getRoot()).getChildren().add(root); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Title"); Group root = new Group(); Scene scene = new Scene(root, 600, 330, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);// ww w .j a v a 2 s. c o m gridpane.setVgap(10); final ImageView imv = new ImageView(); final Image image2 = new Image(Main.class.getResourceAsStream("button.png")); imv.setImage(image2); final HBox pictureRegion = new HBox(); pictureRegion.getChildren().add(imv); gridpane.add(pictureRegion, 1, 1); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Title"); Group root = new Group(); Scene scene = new Scene(root, 600, 330, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);//w ww . j av a 2s. c o m gridpane.setVgap(10); final ImageView imv = new ImageView(); imv.setFitWidth(100); final Image image2 = new Image(Main.class.getResourceAsStream("button.png")); imv.setImage(image2); final HBox pictureRegion = new HBox(); pictureRegion.getChildren().add(imv); gridpane.add(pictureRegion, 1, 1); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Title"); Group root = new Group(); Scene scene = new Scene(root, 600, 330, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);//w w w.j av a2 s . c o m gridpane.setVgap(10); final ImageView imv = new ImageView(); imv.setPreserveRatio(true); final Image image2 = new Image(Main.class.getResourceAsStream("button.png")); imv.setImage(image2); final HBox pictureRegion = new HBox(); pictureRegion.getChildren().add(imv); gridpane.add(pictureRegion, 1, 1); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Title"); Group root = new Group(); Scene scene = new Scene(root, 600, 330, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);// ww w. j a v a 2 s.com gridpane.setVgap(10); final ImageView imv = new ImageView(); final Image image2 = new Image(Main.class.getResourceAsStream("a.jpg")); imv.setImage(image2); imv.setEffect(new SepiaTone()); // default is full (1.0) effect final HBox pictureRegion = new HBox(); pictureRegion.getChildren().add(imv); gridpane.add(pictureRegion, 1, 1); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }