/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package button; import javafx.application.Application; import static javafx.application.Application.launch; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.stage.Stage; /** * * @author paru */ import javafx.scene.Scene; import javafx.scene.layout.VBox; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.FlowPane; import javafx.scene.layout.Pane; import javafx.scene.text.Font; /** * * @author shubov */ public class ButtonHoverContract extends Application { @Override public void start(Stage stage) { Group grp = new Group(); final VBox outer = new VBox(10); final Pane pane = new Pane(); final FlowPane fp = new FlowPane(); Button button = new Button("VBox"); outer.getChildren().addAll(fp, pane); fp.getChildren().add(button); final VBox vbox = new VBox(); final VBox inner = new VBox(); vbox.getChildren().addAll(new Label("Defaults"), inner); Button b1 = new Button("btn"); vbox.setTranslateX(200); vbox.setTranslateY(200); b1.setFont(new Font(14)); b1.setMaxWidth(85); b1.setMaxHeight(85); inner.getChildren().add(b1); vbox.setPrefSize(80, 240); vbox.setStyle("-fx-border-color: red;"); button.setOnAction(new EventHandler() { @Override public void handle(ActionEvent t) { pane.getChildren().add(vbox); } }); grp.getChildren().addAll(outer); Scene scene = new Scene(grp, 800, 800); stage.setScene(scene); stage.show(); } public static void main(String args[]) { launch(args); } }