List of usage examples for javafx.scene.layout VBox VBox
public VBox(Node... children)
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Split Views"); Group root = new Group(); Scene scene = new Scene(root, 350, 250, Color.WHITE); SplitPane splitPane = new SplitPane(); splitPane.prefWidthProperty().bind(scene.widthProperty()); splitPane.prefHeightProperty().bind(scene.heightProperty()); VBox leftArea = new VBox(10); HBox rowBox = new HBox(20); final Text leftText = TextBuilder.create().text("Left ").translateX(20).fill(Color.RED) .font(Font.font(null, FontWeight.BOLD, 20)).build(); rowBox.getChildren().add(leftText);//from ww w. ja va 2s.co m leftArea.getChildren().add(rowBox); leftArea.setAlignment(Pos.CENTER); SplitPane splitPane2 = new SplitPane(); splitPane2.setOrientation(Orientation.VERTICAL); splitPane2.prefWidthProperty().bind(scene.widthProperty()); splitPane2.prefHeightProperty().bind(scene.heightProperty()); HBox centerArea = new HBox(); final Text upperRight = TextBuilder.create().text("Text").x(100).y(50).fill(Color.RED) .font(Font.font(null, FontWeight.BOLD, 35)).translateY(50).build(); centerArea.getChildren().add(upperRight); HBox rightArea = new HBox(); final Text lowerRight = TextBuilder.create().text("Lower Right").x(100).y(50).fill(Color.RED) .font(Font.font(null, FontWeight.BOLD, 35)).translateY(50).build(); rightArea.getChildren().add(lowerRight); splitPane2.getItems().add(centerArea); splitPane2.getItems().add(rightArea); splitPane.getItems().add(leftArea); splitPane.getItems().add(splitPane2); ObservableList<SplitPane.Divider> dividers = splitPane.getDividers(); for (int i = 0; i < dividers.size(); i++) { dividers.get(i).setPosition((i + 1.0) / 3); } HBox hbox = new HBox(); hbox.getChildren().add(splitPane); root.getChildren().add(hbox); primaryStage.setScene(scene); primaryStage.show(); }
From source file:org.pdfsam.ui.dashboard.AboutDashboardPane.java
@PostConstruct void init() {/*from w ww. j a v a2 s. c o m*/ VBox left = new VBox(5); addSectionTitle(name, left); left.getChildren().addAll(new Label(String.format("ver. %s", version)), new Label("Copyright 2014 by Andrea Vacondio")); addHyperlink(null, "http://www.gnu.org/licenses/agpl-3.0.html", "GNU Affero General Public License v3", left); addHyperlink(AwesomeIcon.HOME, "http://www.pdfsam.org", "www.pdfsam.org", left); addHyperlink(AwesomeIcon.RSS_SQUARE, "http://www.pdfsam.org/feed/", DefaultI18nContext.getInstance().i18n("Subscribe to the official news feed"), left); addSectionTitle(DefaultI18nContext.getInstance().i18n("Environment"), left); left.getChildren().add(new Label(String.format("%s %s", System.getProperty("java.runtime.name"), System.getProperty("java.runtime.version")))); left.getChildren() .add(new Label(String.format("JavaFX %s", com.sun.javafx.runtime.VersionInfo.getRuntimeVersion()))); left.getChildren().add(new Label(DefaultI18nContext.getInstance().i18n("Max memory {0}", FileUtils.byteCountToDisplaySize(Runtime.getRuntime().maxMemory())))); addSectionTitle(DefaultI18nContext.getInstance().i18n("Thanks to"), left); addHyperlink(null, "http://www.pdfsam.org/thanks_to", DefaultI18nContext.getInstance().i18n("The open source projects making PDFsam possible"), left); VBox right = new VBox(5); addSectionTitle(DefaultI18nContext.getInstance().i18n("Support"), right); addHyperlink(AwesomeIcon.BUG, "http://www.pdfsam.org/issue_tracker", DefaultI18nContext.getInstance().i18n("Bug and feature requests"), right); addHyperlink(AwesomeIcon.QUESTION_CIRCLE, "http://www.pdfsam.org/wiki", "HowTo wiki", right); addHyperlink(AwesomeIcon.YOUTUBE_PLAY, "http://www.pdfsam.org/quickstart_video", DefaultI18nContext.getInstance().i18n("Play the \"get started\" video"), right); addSectionTitle(DefaultI18nContext.getInstance().i18n("Contribute"), right); addHyperlink(AwesomeIcon.GITHUB, "http://www.pdfsam.org/scm", DefaultI18nContext.getInstance().i18n("Fork PDFsam on GitHub"), right); addHyperlink(AwesomeIcon.DOLLAR, "http://www.pdfsam.org/donate", DefaultI18nContext.getInstance().i18n("Donate"), right); addSectionTitle(DefaultI18nContext.getInstance().i18n("Social"), right); addHyperlink(AwesomeIcon.TWITTER_SQUARE, "http://www.pdfsam.org/twitter", DefaultI18nContext.getInstance().i18n("Follow us on Twitter"), right); addHyperlink(AwesomeIcon.GOOGLE_PLUS_SQUARE, "http://www.pdfsam.org/gplus", DefaultI18nContext.getInstance().i18n("Follow us on Google Plus"), right); addHyperlink(AwesomeIcon.FACEBOOK_SQUARE, "http://www.pdfsam.org/facebook", DefaultI18nContext.getInstance().i18n("Like us on Facebook"), right); getChildren().addAll(left, right); }
From source file:Main.java
License:asdf
@Override public void start(Stage primaryStage) { User user = new User(); Group root = new Group(); Scene scene = new Scene(root, 320, 100); primaryStage.setScene(scene);//from www .j a v a 2 s . c o m Text userName = new Text(); userName.textProperty().bind(user.userNameProperty()); PasswordField passwordField = new PasswordField(); passwordField.setPromptText("Password"); user.passwordProperty().bind(passwordField.textProperty()); // user hits the enter key passwordField.setOnAction(actionEvent -> { if (accessGranted.get()) { System.out.println("granted access:" + user.getUserName()); System.out.println("password:" + user.getPassword()); Platform.exit(); } else { primaryStage.setTitle("no access"); } }); passwordField.textProperty().addListener((obs, ov, nv) -> { boolean granted = passwordField.getText().equals(MY_PASS); accessGranted.set(granted); if (granted) { primaryStage.setTitle(""); } }); VBox formLayout = new VBox(4); formLayout.getChildren().addAll(userName, passwordField); formLayout.setLayoutX(12); formLayout.setLayoutY(12); root.getChildren().addAll(formLayout); primaryStage.show(); }
From source file:org.pdfsam.ui.dashboard.about.AboutDashboardPane.java
@Inject public AboutDashboardPane(Pdfsam pdfsam) { getStyleClass().add("dashboard-container"); VBox left = new VBox(5); addSectionTitle(pdfsam.name(), left); Label copyright = new Label("Copyright 2014 by Andrea Vacondio"); AwesomeDude.setIcon(copyright, AwesomeIcon.COPYRIGHT); left.getChildren().addAll(new Label(String.format("ver. %s", pdfsam.version())), copyright); addHyperlink(null, "http://www.gnu.org/licenses/agpl-3.0.html", "GNU Affero General Public License v3", left);//from ww w . ja v a 2s.c om addHyperlink(AwesomeIcon.HOME, "http://www.pdfsam.org", "www.pdfsam.org", left); addHyperlink(AwesomeIcon.RSS_SQUARE, "http://www.pdfsam.org/feed/", DefaultI18nContext.getInstance().i18n("Subscribe to the official news feed"), left); addSectionTitle(DefaultI18nContext.getInstance().i18n("Environment"), left); Label runtime = new Label(String.format("%s %s", System.getProperty("java.runtime.name"), System.getProperty("java.runtime.version"))); Label fxRuntime = new Label( String.format("JavaFX %s", com.sun.javafx.runtime.VersionInfo.getRuntimeVersion())); Label memory = new Label(DefaultI18nContext.getInstance().i18n("Max memory {0}", FileUtils.byteCountToDisplaySize(Runtime.getRuntime().maxMemory()))); Button copyButton = new Button(DefaultI18nContext.getInstance().i18n("Copy to clipboard")); AwesomeDude.setIcon(copyButton, AwesomeIcon.COPY); copyButton.getStyleClass().addAll(Style.BUTTON.css()); copyButton.setId("copyEnvDetails"); copyButton.setOnAction(a -> { ClipboardContent content = new ClipboardContent(); writeContent(Arrays.asList(pdfsam.name(), pdfsam.version(), runtime.getText(), fxRuntime.getText(), memory.getText())).to(content); Clipboard.getSystemClipboard().setContent(content); }); left.getChildren().addAll(runtime, fxRuntime, memory, copyButton); addSectionTitle(DefaultI18nContext.getInstance().i18n("Thanks to"), left); addHyperlink(null, "http://www.pdfsam.org/thanks_to", DefaultI18nContext.getInstance().i18n("The open source projects making PDFsam possible"), left); VBox right = new VBox(5); addSectionTitle(DefaultI18nContext.getInstance().i18n("Support"), right); addHyperlink(AwesomeIcon.BUG, "http://www.pdfsam.org/issue_tracker", DefaultI18nContext.getInstance().i18n("Bug and feature requests"), right); addHyperlink(AwesomeIcon.QUESTION_CIRCLE, "http://www.pdfsam.org/wiki", "HowTo wiki", right); addHyperlink(AwesomeIcon.YOUTUBE_PLAY, "http://www.pdfsam.org/quickstart_video", DefaultI18nContext.getInstance().i18n("Play the \"get started\" video"), right); addSectionTitle(DefaultI18nContext.getInstance().i18n("Contribute"), right); addHyperlink(AwesomeIcon.GITHUB, "http://www.pdfsam.org/scm", DefaultI18nContext.getInstance().i18n("Fork PDFsam on GitHub"), right); addHyperlink(AwesomeIcon.FLAG_ALT, "http://www.pdfsam.org/translate", DefaultI18nContext.getInstance().i18n("Translate"), right); addHyperlink(AwesomeIcon.DOLLAR, "http://www.pdfsam.org/donate", DefaultI18nContext.getInstance().i18n("Donate"), right); addSectionTitle(DefaultI18nContext.getInstance().i18n("Social"), right); addHyperlink(AwesomeIcon.TWITTER_SQUARE, "http://www.pdfsam.org/twitter", DefaultI18nContext.getInstance().i18n("Follow us on Twitter"), right); addHyperlink(AwesomeIcon.GOOGLE_PLUS_SQUARE, "http://www.pdfsam.org/gplus", DefaultI18nContext.getInstance().i18n("Follow us on Google Plus"), right); addHyperlink(AwesomeIcon.FACEBOOK_SQUARE, "http://www.pdfsam.org/facebook", DefaultI18nContext.getInstance().i18n("Like us on Facebook"), right); getChildren().addAll(left, right); }
From source file:Main.java
public VBox createPage(int pageIndex) { VBox box = new VBox(5); int page = pageIndex * itemsPerPage(); for (int i = page; i < page + itemsPerPage(); i++) { Label font = new Label(fonts[i]); box.getChildren().add(font);/*from ww w.j ava2 s .c o m*/ } return box; }
From source file:Main.java
public VBox createPage(int pageIndex) { VBox box = new VBox(5); int page = pageIndex * itemsPerPage(); for (int i = page; i < page + itemsPerPage(); i++) { TextArea text = new TextArea(textPages[i]); text.setWrapText(true);// w w w.ja v a 2 s. c o m box.getChildren().add(text); } return box; }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("ObservableLists"); Group root = new Group(); Scene scene = new Scene(root, 400, 250, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);//w w w .j a va 2 s. co m gridpane.setVgap(10); Label candidatesLbl = new Label("Left"); GridPane.setHalignment(candidatesLbl, HPos.CENTER); gridpane.add(candidatesLbl, 0, 0); Label heroesLbl = new Label("Right"); gridpane.add(heroesLbl, 2, 0); GridPane.setHalignment(heroesLbl, HPos.CENTER); final ObservableList<String> lefts = FXCollections.observableArrayList("A", "B", "C"); final ListView<String> leftListView = new ListView<String>(lefts); leftListView.setPrefWidth(150); leftListView.setPrefHeight(150); gridpane.add(leftListView, 0, 1); final ObservableList<String> rights = FXCollections.observableArrayList(); final ListView<String> rightListView = new ListView<String>(rights); rightListView.setPrefWidth(150); rightListView.setPrefHeight(150); gridpane.add(rightListView, 2, 1); Button sendRightButton = new Button(">"); sendRightButton.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { String item = leftListView.getSelectionModel().getSelectedItem(); if (item != null) { leftListView.getSelectionModel().clearSelection(); lefts.remove(item); rights.add(item); } } }); Button sendLeftButton = new Button("<"); sendLeftButton.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { String item = rightListView.getSelectionModel().getSelectedItem(); if (item != null) { rightListView.getSelectionModel().clearSelection(); rights.remove(item); lefts.add(item); } } }); VBox vbox = new VBox(5); vbox.getChildren().addAll(sendRightButton, sendLeftButton); gridpane.add(vbox, 1, 1); GridPane.setConstraints(vbox, 1, 1, 1, 2, HPos.CENTER, VPos.CENTER); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { BorderPane root = new BorderPane(); Scene scene = new Scene(root, 400, 250, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);/*from www. j av a2 s . c om*/ gridpane.setVgap(10); ColumnConstraints column1 = new ColumnConstraints(150, 150, Double.MAX_VALUE); ColumnConstraints column2 = new ColumnConstraints(50); ColumnConstraints column3 = new ColumnConstraints(150, 150, Double.MAX_VALUE); column1.setHgrow(Priority.ALWAYS); column3.setHgrow(Priority.ALWAYS); gridpane.getColumnConstraints().addAll(column1, column2, column3); Label candidatesLbl = new Label("Candidates"); GridPane.setHalignment(candidatesLbl, HPos.CENTER); gridpane.add(candidatesLbl, 0, 0); Label selectedLbl = new Label("selected"); gridpane.add(selectedLbl, 2, 0); GridPane.setHalignment(selectedLbl, HPos.CENTER); // Candidates final ObservableList<String> candidates = FXCollections.observableArrayList("Z", "A", "B", "C", "D"); final ListView<String> candidatesListView = new ListView<>(candidates); gridpane.add(candidatesListView, 0, 1); final ObservableList<String> selected = FXCollections.observableArrayList(); final ListView<String> heroListView = new ListView<>(selected); gridpane.add(heroListView, 2, 1); Button sendRightButton = new Button(" > "); sendRightButton.setOnAction((ActionEvent event) -> { String potential = candidatesListView.getSelectionModel().getSelectedItem(); if (potential != null) { candidatesListView.getSelectionModel().clearSelection(); candidates.remove(potential); selected.add(potential); } }); Button sendLeftButton = new Button(" < "); sendLeftButton.setOnAction((ActionEvent event) -> { String s = heroListView.getSelectionModel().getSelectedItem(); if (s != null) { heroListView.getSelectionModel().clearSelection(); selected.remove(s); candidates.add(s); } }); VBox vbox = new VBox(5); vbox.getChildren().addAll(sendRightButton, sendLeftButton); gridpane.add(vbox, 1, 1); root.setCenter(gridpane); GridPane.setVgrow(root, Priority.ALWAYS); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { BorderPane root = new BorderPane(); Scene scene = new Scene(root, 400, 250, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);/*from ww w . ja va2 s . c o m*/ gridpane.setVgap(10); ColumnConstraints column1 = new ColumnConstraints(150, 150, Double.MAX_VALUE); ColumnConstraints column2 = new ColumnConstraints(50); ColumnConstraints column3 = new ColumnConstraints(150, 150, Double.MAX_VALUE); column1.setHgrow(Priority.ALWAYS); column3.setHgrow(Priority.ALWAYS); gridpane.getColumnConstraints().addAll(column1, column2, column3); // Candidates label Label candidatesLbl = new Label("Candidates"); GridPane.setHalignment(candidatesLbl, HPos.CENTER); gridpane.add(candidatesLbl, 0, 0); // Heroes label Label heroesLbl = new Label("Letters"); gridpane.add(heroesLbl, 2, 0); GridPane.setHalignment(heroesLbl, HPos.CENTER); final ObservableList<String> candidates = FXCollections.observableArrayList("A", "B", "C", "D"); final ListView<String> candidatesListView = new ListView<>(candidates); gridpane.add(candidatesListView, 0, 1); final ObservableList<String> heroes = FXCollections.observableArrayList(); final ListView<String> heroListView = new ListView<>(heroes); gridpane.add(heroListView, 2, 1); Button sendRightButton = new Button(" > "); sendRightButton.setOnAction((ActionEvent event) -> { String potential = candidatesListView.getSelectionModel().getSelectedItem(); if (potential != null) { candidatesListView.getSelectionModel().clearSelection(); candidates.remove(potential); heroes.add(potential); } }); Button sendLeftButton = new Button(" < "); sendLeftButton.setOnAction((ActionEvent event) -> { String notHero = heroListView.getSelectionModel().getSelectedItem(); if (notHero != null) { heroListView.getSelectionModel().clearSelection(); heroes.remove(notHero); candidates.add(notHero); } }); // place the buttons VBox vbox = new VBox(5); vbox.setAlignment(Pos.CENTER); vbox.getChildren().addAll(sendRightButton, sendLeftButton); GridPane.setHalignment(vbox, HPos.CENTER); gridpane.add(vbox, 1, 1); // place the grid root.setCenter(gridpane); GridPane.setVgrow(root, Priority.ALWAYS); primaryStage.setScene(scene); primaryStage.show(); }
From source file:de.rkl.tools.tzconv.view.ZoneIdSelectionDialog.java
private Node createZoneIdSelectionBox() { final HBox mainListBox = new HBox(5); partition(newArrayList(ApplicationModel.ZONE_OFFSETS_2_ZONE_IDS.values()), 40).forEach(zoneIds -> { final VBox columnBox = new VBox(5); zoneIds.forEach(zoneId -> {/*from w ww . j a va2s.c o m*/ final CheckBox zoneIdCheckbox = new CheckBox(zoneId.toString()); zoneIdCheckbox.setSelected(applicationModel.selectedZoneIds.contains(zoneId)); zoneIdCheckbox.selectedProperty().addListener((observable, oldValue, newValue) -> { if (newValue) { pendingSelectedZoneIds.add(zoneId); } else { pendingSelectedZoneIds.remove(zoneId); } }); columnBox.getChildren().add(zoneIdCheckbox); zoneIdCheckboxes.add(zoneIdCheckbox); }); mainListBox.getChildren().add(columnBox); }); return mainListBox; }