List of usage examples for javafx.scene.layout VBox VBox
public VBox()
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);// w w w . j a v a 2 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) { Scene scene = new Scene(new Group()); stage.setTitle("Button Sample"); stage.setWidth(300);/* w w w . ja v a2 s . c o m*/ stage.setHeight(190); VBox vbox = new VBox(); vbox.setLayoutX(20); vbox.setLayoutY(20); Image image = new Image(getClass().getResourceAsStream("a.png")); Button button1 = new Button("Accept", new ImageView(image)); button1.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Accepted"); } }); vbox.getChildren().add(button1); vbox.setSpacing(10); ((Group) scene.getRoot()).getChildren().add(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { ChoiceBox<String> choiceBox = new ChoiceBox<String>(cursors); StringConverter sc = new NumberStringConverter(); choiceBox.setConverter(sc);/*from ww w . j a v a 2 s . c o m*/ VBox box = new VBox(); box.getChildren().add(choiceBox); final Scene scene = new Scene(box, 300, 250); scene.setFill(null); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { ChoiceBox<String> choiceBox = new ChoiceBox<String>(); choiceBox.setItems(cursors);/*ww w .j av a 2 s . c o m*/ SingleSelectionModel ssm = choiceBox.getSelectionModel(); choiceBox.setSelectionModel(ssm); VBox box = new VBox(); box.getChildren().add(choiceBox); final Scene scene = new Scene(box, 300, 250); scene.setFill(null); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Button Sample"); stage.setWidth(300);// w w w . ja v a 2s .c om stage.setHeight(190); VBox vbox = new VBox(); vbox.setLayoutX(20); vbox.setLayoutY(20); final Button button1 = new Button("Accept"); button1.addEventHandler(MouseEvent.MOUSE_ENTERED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { button1.setEffect(shadow); } }); button1.addEventHandler(MouseEvent.MOUSE_EXITED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { button1.setEffect(null); } }); vbox.getChildren().add(button1); vbox.setSpacing(10); ((Group) scene.getRoot()).getChildren().add(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
License:asdf
@Override public void start(final Stage stage) { stage.setTitle("HTML"); stage.setWidth(500);/* w ww . j a va 2 s . com*/ stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); final WebView browser = new WebView(); final WebEngine webEngine = browser.getEngine(); ScrollPane scrollPane = new ScrollPane(); scrollPane.setContent(browser); webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<State>() { @Override public void changed(ObservableValue ov, State oldState, State newState) { if (newState == Worker.State.SUCCEEDED) { stage.setTitle(webEngine.getLocation()); System.out.println("called"); } } }); webEngine.load("http://javafx.com"); webEngine.loadContent("<b>asdf</b>"); root.getChildren().addAll(scrollPane); scene.setRoot(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("Sample"); stage.setWidth(300);// w w w. j a va 2 s. c om stage.setHeight(190); VBox vbox = new VBox(); vbox.setLayoutX(20); vbox.setLayoutY(20); final String content = "Lorem ipsum"; final Text text = new Text(10, 20, ""); final Animation animation = new Transition() { { setCycleDuration(Duration.millis(2000)); } protected void interpolate(double frac) { final int length = content.length(); final int n = Math.round(length * (float) frac); text.setText(content.substring(0, n)); } }; animation.play(); vbox.getChildren().add(text); vbox.setSpacing(10); ((Group) scene.getRoot()).getChildren().add(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Sample"); stage.setWidth(300);/*w w w. ja va 2 s. c o m*/ stage.setHeight(190); VBox vbox = new VBox(); vbox.setLayoutX(20); vbox.setLayoutY(20); final String content = "Lorem ipsum"; final Text text = new Text(10, 20, ""); final Animation animation = new Transition() { { setCycleDuration(Duration.millis(2000)); } protected void interpolate(double frac) { final int length = content.length(); final int n = Math.round(length * (float) frac); text.setText(content.substring(0, n)); } }; animation.play(); vbox.getChildren().add(text); vbox.setSpacing(10); ((Group) scene.getRoot()).getChildren().add(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 260, 80); stage.setScene(scene);//from w w w . j a va2 s. c o m VBox vb = new VBox(); Rectangle rect = new Rectangle(100, 40, 100, 100); rect.setArcHeight(50); rect.setArcWidth(50); rect.setFill(Color.VIOLET); final Duration SEC_2 = Duration.millis(2000); final Duration SEC_3 = Duration.millis(3000); FadeTransition ft = new FadeTransition(SEC_3); ft.setFromValue(1.0f); ft.setToValue(0.3f); ft.setAutoReverse(true); TranslateTransition tt = new TranslateTransition(SEC_2); tt.setFromX(-100f); tt.setToX(100f); tt.setAutoReverse(true); RotateTransition rt = new RotateTransition(SEC_3); rt.setByAngle(180f); rt.setAutoReverse(true); ScaleTransition st = new ScaleTransition(SEC_2); st.setByX(1.5f); st.setByY(1.5f); st.setAutoReverse(true); ParallelTransition pt = new ParallelTransition(rect, ft, tt, rt, st); pt.play(); vb.getChildren().add(rect); scene.setRoot(vb); 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 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(); }