List of usage examples for javafx.scene.layout VBox setSpacing
public final void setSpacing(double value)
From source file:main.TestManager.java
/** * Displays given test. Intended for testing and * evaluating correct answers. (student mode only) * @param test test to display//from w w w. j a va 2s .c o m * @param stage */ public static void displayTest(Test test, Stage stage) { Debugger.println(test.getName() + " - is displayed."); TabPane tabPane = new TabPane(); int counter = 1; for (Question q : test.getQuestions()) { Label instruction = new Label(q.question); instruction.setStyle("-fx-font-size: 20"); Pane choices = q.getPaneOfChoices(); VBox vbox = new VBox(instruction, choices); vbox.setSpacing(10); Tab tab = new Tab("Otzka " + Integer.toString(counter), vbox); tab.setStyle("-fx-font-size: 20"); tabPane.getTabs().add(tab); counter++; } Button finish = new Button("Ukon?i test!"); finish.setStyle("-fx-font-size: 20"); finish.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { try { test.evaluate(stage); } catch (IOException e) { Alert alert = new Alert(AlertType.ERROR); alert.setContentText("Ojoj, vyskytol sa problm. Aplikcia sa mus ukon?i."); alert.showAndWait(); System.exit(0); } } }); Button nextQuestion = new Button("alia"); nextQuestion.setStyle("-fx-font-size: 20"); nextQuestion.setOnAction(e -> tabPane.getSelectionModel().selectNext()); HBox buttons = new HBox(finish, nextQuestion); buttons.setSpacing(10); buttons.setAlignment(Pos.BOTTOM_CENTER); VBox outerVBox = new VBox(tabPane, buttons); outerVBox.setPadding(new Insets(10, 10, 10, 10)); Scene scene = new Scene(outerVBox); stage.setScene(scene); stage.show(); }
From source file:net.thirdy.blackmarket.controls.Dialogs.java
public static void showAbout() { Alert alert = new Alert(AlertType.INFORMATION); alert.setGraphic(new Region()); alert.setTitle("Blackmarket " + BlackmarketApplication.VERSION); alert.setContentText(""); alert.setHeaderText(""); TextArea textArea = new TextArea("Copyright 2015 Vicente de Rivera III" + "\r\n" + "\r\n http://thirdy.github.io/blackmarket" + "\r\n" + "\r\n This program is free software; you can redistribute it and/or" + "\r\n modify it under the terms of the GNU General Public License" + "\r\n as published by the Free Software Foundation; either version 2" + "\r\n of the License, or (at your option) any later version." + "\r\n" + "\r\n This program is distributed in the hope that it will be useful," + "\r\n but WITHOUT ANY WARRANTY; without even the implied warranty of" + "\r\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" + "\r\n GNU General Public License for more details." + "\r\n" + "\r\n You should have received a copy of the GNU General Public License" + "\r\n along with this program; if not, write to the Free Software" + "\r\n Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA." + "\r\n"); textArea.setEditable(false);// www . ja va 2s . c o m textArea.setWrapText(true); Hyperlink website = new Hyperlink("Visit Blackmarket Homepage"); website.setOnAction(e -> { try { SwingUtil.openUrlViaBrowser("http://thirdy.github.io/blackmarket/"); } catch (BlackmarketException ex) { logger.error(ex.getMessage(), ex); } }); Hyperlink exwebsite = new Hyperlink("Visit Exile Tools Homepage"); exwebsite.setOnAction(e -> { try { SwingUtil.openUrlViaBrowser("http://exiletools.com/"); } catch (BlackmarketException ex) { logger.error(ex.getMessage(), ex); } }); VBox content = new VBox(new ImageView(new Image("/images/blackmarket-logo.png")), new Label( "Blackmarket is fan-made software for Path of Exile but is not affiliated with Grinding Gear Games in any way."), new Label("A few tips:"), new Label("CTRL + Space - hot key to slide the search control pane"), new Label("CTRL + Enter - hot key to run the search"), new Label("Advance mode grants you power overwhelming of Elastic Search"), new Label("For more information and updates,"), website, new Label("Blackmarket uses Exile Tools Shop Indexer Elastic Search API:"), exwebsite, new Label("Comics by /u/gallio"), new Label("Blackmarket is 100% Free and Open Source Software under GPLv2:"), textArea); content.setSpacing(8); alert.getDialogPane().setContent(content); alert.showAndWait(); }
From source file:Main.java
@Override public void start(Stage stage) { Label nameLbl = new Label("Enter your name:"); TextField nameFld = new TextField(); Label msg = new Label(); Button sayHelloBtn = new Button("Say Hello"); sayHelloBtn.setOnAction(e -> {/*from w w w . ja v a 2s .c om*/ String name = nameFld.getText(); if (name.trim().length() > 0) { msg.setText("Hello " + name); } else { msg.setText("Hello there"); } }); VBox root = new VBox(); root.setSpacing(5); root.getChildren().addAll(nameLbl, nameFld, msg, sayHelloBtn); Scene scene = new Scene(root, 350, 150); stage.setScene(scene); stage.setTitle("hi"); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Label nameLbl = new Label("Enter your name:"); TextField nameFld = new TextField(); Label msg = new Label(); msg.setStyle("-fx-text-fill: blue;"); Button sayHelloBtn = new Button("Say Hello"); Button exitBtn = new Button("Exit"); sayHelloBtn.setOnAction(e -> {//from w w w .j a v a 2s . c o m String name = nameFld.getText(); if (name.trim().length() > 0) { msg.setText("Hello " + name); } else { msg.setText("Hello there"); } }); exitBtn.setOnAction(e -> Platform.exit()); VBox root = new VBox(); root.setSpacing(5); root.getChildren().addAll(nameLbl, nameFld, msg, sayHelloBtn, exitBtn); Scene scene = new Scene(root, 350, 150); 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, 300, 150); stage.setScene(scene);/*from ww w.j av a2s .com*/ stage.setTitle("Progress Controls"); for (int i = 0; i < values.length; i++) { final Label label = labels[i] = new Label(); label.setText("progress:" + values[i]); final ProgressBar pb = pbs[i] = new ProgressBar(); pb.setProgress(values[i]); final ProgressIndicator pin = pins[i] = new ProgressIndicator(); pin.setProgress(values[i]); final HBox hb = hbs[i] = new HBox(); hb.setSpacing(5); hb.setAlignment(Pos.CENTER); hb.getChildren().addAll(label, pb, pin); } final VBox vb = new VBox(); vb.setSpacing(5); vb.getChildren().addAll(hbs); scene.setRoot(vb); 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);//from w ww.ja v a2 s. 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(""); stage.setWidth(230);//from w w w. j ava 2 s .c om 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.setWidth(450);//from ww w. j a v a2 s. c o m stage.setHeight(550); TableColumn firstNameCol = new TableColumn("First Name"); firstNameCol.setMinWidth(100); firstNameCol.setCellValueFactory(new PropertyValueFactory<>("firstName")); TableColumn lastNameCol = new TableColumn("Last Name"); lastNameCol.setMinWidth(100); lastNameCol.setCellValueFactory(new PropertyValueFactory<>("lastName")); table.setItems(data); table.getColumns().addAll(firstNameCol, lastNameCol); firstNameCol.setSortType(TableColumn.SortType.DESCENDING); lastNameCol.setSortable(false); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(table); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(450);//from www. ja v a 2 s.co m stage.setHeight(550); TableColumn firstNameCol = new TableColumn("First Name"); firstNameCol.setMinWidth(100); firstNameCol.setCellValueFactory(new PropertyValueFactory<>("firstName")); TableColumn lastNameCol = new TableColumn("Last Name"); lastNameCol.setMinWidth(100); lastNameCol.setCellValueFactory(new PropertyValueFactory<>("lastName")); table.setItems(data); table.getColumns().addAll(firstNameCol, lastNameCol); final Button addButton = new Button("Add"); addButton.setOnAction((ActionEvent e) -> { data.add(new Person("Z", "X")); }); hb.getChildren().addAll(addButton); hb.setSpacing(3); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(table, hb); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("VBox Test"); VBox vb = new VBox(); vb.setPadding(new Insets(10, 50, 50, 50)); vb.setSpacing(10); Label lbl = new Label("VBox"); lbl.setFont(Font.font("Amble CN", FontWeight.BOLD, 24)); vb.getChildren().add(lbl);/* ww w . ja va2s .c o m*/ Button btn1 = new Button(); btn1.setText("Button1"); vb.getChildren().add(btn1); Button btn2 = new Button(); btn2.setText("Button2"); vb.getChildren().add(btn2); Button btn3 = new Button(); btn3.setText("Button3"); vb.getChildren().add(btn3); Button btn4 = new Button(); btn4.setText("Button4"); vb.getChildren().add(btn4); // Adding VBox to the scene Scene scene = new Scene(vb); primaryStage.setScene(scene); primaryStage.show(); }