List of usage examples for javafx.scene.layout HBox HBox
public HBox(double spacing, Node... children)
From source file:Main.java
@Override public void start(Stage stage) { Arc arc = new Arc(0, 0, 50, 100, 0, 90); arc.setFill(Color.GRAY);//from w w w. j a v a 2 s . c om arc.setStroke(Color.BLACK); arc.setType(ArcType.ROUND); Arc arc1 = new Arc(0, 0, 50, 100, 0, 90); arc1.setFill(Color.GRAY); arc1.setStroke(Color.BLACK); arc1.setType(ArcType.ROUND); HBox box = new HBox(arc, arc1); box.setSpacing(10); Scene scene = new Scene(box); stage.setScene(scene); stage.setTitle("Test"); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Path pathTriangle = new Path(new MoveTo(50, 0), new LineTo(0, 50), new LineTo(100, 50), new LineTo(50, 0)); pathTriangle.setFill(Color.LIGHTGRAY); pathTriangle.setStroke(Color.BLACK); SVGPath svgTriangle = new SVGPath(); svgTriangle.setContent("M50, 0 L10, 20 L100, 50 Z"); svgTriangle.setFill(Color.LIGHTGRAY); svgTriangle.setStroke(Color.BLACK); HBox root = new HBox(pathTriangle, svgTriangle); root.setSpacing(10);/*w ww.j av a 2 s .com*/ root.setStyle("-fx-padding: 10;" + "-fx-border-style: solid inside;" + "-fx-border-width: 2;" + "-fx-border-insets: 5;" + "-fx-border-radius: 5;" + "-fx-border-color: blue;"); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("2D Shapes using Path and SVGPath Classes"); stage.show(); }
From source file:Main.java
private VBox getCenter() { Label nameLbl = new Label("Name:"); TextField nameFld = new TextField(); HBox.setHgrow(nameFld, Priority.ALWAYS); HBox nameFields = new HBox(nameLbl, nameFld); Label descLbl = new Label("Description:"); TextArea descText = new TextArea(); descText.setPrefColumnCount(20);/* w w w. j a v a2s. c o m*/ descText.setPrefRowCount(5); VBox.setVgrow(descText, Priority.ALWAYS); VBox center = new VBox(nameFields, descLbl, descText); return center; }
From source file:org.pdfsam.ui.dashboard.preference.PreferenceWorkspacePane.java
@Inject public PreferenceWorkspacePane(@Named("workingDirectory") PreferenceBrowsableDirectoryField workingDirectory, @Named("workspace") PreferenceBrowsableFileField workspace, @Named("saveWorkspaceOnExit") PreferenceCheckBox saveWorkspaceOnExit) { I18nContext i18n = DefaultI18nContext.getInstance(); workingDirectory.getTextField()//w ww . j av a 2 s . c om .setPromptText(i18n.i18n("Select a directory where documents will be saved and loaded by default")); workingDirectory.setBrowseWindowTitle(i18n.i18n("Select a directory")); HBox workigDirPane = new HBox(workingDirectory, helpIcon(i18n.i18n("Select a directory where documents will be saved and loaded by default"))); HBox.setHgrow(workingDirectory, Priority.ALWAYS); workigDirPane.getStyleClass().add("with-help-hcontainer"); workspace.getTextField().setPromptText( i18n.i18n("Select a previously saved workspace that will be automatically loaded at startup")); workspace.setBrowseWindowTitle(i18n.i18n("Select a workspace")); HBox workspaceDirPane = new HBox(workspace, helpIcon( i18n.i18n("Select a previously saved workspace that will be automatically loaded at startup"))); HBox.setHgrow(workspace, Priority.ALWAYS); workspaceDirPane.getStyleClass().add("with-help-hcontainer"); workspace.getTextField().validProperty().addListener((o, oldVal, newVal) -> { saveWorkspaceOnExit .setDisable(isBlank(workspace.getTextField().getText()) || newVal != ValidationState.VALID); }); workspace.getTextField().validate(); getChildren().addAll(new Label(i18n.i18n("Default working directory:")), workigDirPane, new Label(i18n.i18n("Load default workspace at startup:")), workspaceDirPane, saveWorkspaceOnExit); getStyleClass().addAll(Style.CONTAINER.css()); }
From source file:org.pdfsam.ui.dialog.OverwriteConfirmationDialog.java
@Inject public OverwriteConfirmationDialog(StylesConfig styles) { initModality(Modality.WINDOW_MODAL); initStyle(StageStyle.UTILITY);/*from ww w . j a va 2 s . c o m*/ setResizable(false); BorderPane containerPane = new BorderPane(); containerPane.getStyleClass().addAll(Style.CONTAINER.css()); containerPane.getStyleClass().addAll("-pdfsam-dialog", "-pdfsam-warning-dialog"); containerPane.setCenter(dialogContent); HBox buttons = new HBox(buildButton(DefaultI18nContext.getInstance().i18n("Overwrite"), true), buildButton(DefaultI18nContext.getInstance().i18n("Cancel"), false)); buttons.getStyleClass().add("-pdfsam-dialog-buttons"); containerPane.setBottom(buttons); Scene scene = new Scene(containerPane); scene.getStylesheets().addAll(styles.styles()); scene.setOnKeyReleased(new HideOnEscapeHandler(this)); setScene(scene); }
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 . ja va2s . c om * @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:org.pdfsam.alternatemix.AlternateMixOptionsPane.java
AlternateMixOptionsPane() { super(Style.DEFAULT_SPACING); this.reverseFirst.setId("reverseFirst"); this.reverseSecond.setId("reverseSecond"); this.reverseSecond.setSelected(true); this.firstStep.setId("alternateMixFirstStep"); this.secondStep.setId("alternateMixSecondStep"); initialState();//w ww .j av a 2s . co m getStyleClass().addAll(Style.CONTAINER.css()); HBox firstStepContainer = new HBox( new Label(DefaultI18nContext.getInstance() .i18n("Switch from the first document to the second one after the following pages")), firstStep); firstStepContainer.getStyleClass().addAll(Style.HCONTAINER.css()); HBox secondStepContainer = new HBox( new Label(DefaultI18nContext.getInstance() .i18n("Switch from the second document to the first one after the following pages")), secondStep); secondStepContainer.getStyleClass().addAll(Style.HCONTAINER.css()); getChildren().addAll(this.reverseFirst, this.reverseSecond, firstStepContainer, secondStepContainer); }
From source file:org.pdfsam.ui.module.ProgressPane.java
public ProgressPane() { this.getStyleClass().add("progress-pane"); this.statusLabel.getStyleClass().add("progress-status"); this.failed.setVisible(false); this.open.setVisible(false); this.bar.getStyleClass().add("pdfsam-footer-bar"); StackPane buttons = new StackPane(failed, open); HBox progressStatusBox = new HBox(statusLabel, buttons); progressStatusBox.getStyleClass().add("progress-status-pane"); HBox.setHgrow(statusLabel, Priority.ALWAYS); statusLabel.setMaxWidth(Double.MAX_VALUE); getChildren().addAll(progressStatusBox, bar); eventStudio().addAnnotatedListeners(this); }
From source file:org.pdfsam.merge.MergeOptionsPane.java
MergeOptionsPane() { super(5);//from w w w. j av a 2 s.com this.containsForms = new CheckBox(DefaultI18nContext.getInstance().i18n("Merge form fields")); this.containsForms.setId("containsFormCheck"); this.containsForms.setTooltip(new Tooltip(DefaultI18nContext.getInstance() .i18n("Some of the selected PDF documents contain forms, merge them"))); this.blankIfOdd = new CheckBox( DefaultI18nContext.getInstance().i18n("Add a blank page if page number is odd")); this.blankIfOdd.setId("blankIfOddCheck"); this.blankIfOdd.setTooltip(new Tooltip(DefaultI18nContext.getInstance() .i18n("Adds a blank page after each merged document if the document has an odd number of pages"))); outline.getItems() .add(keyValue(OutlinePolicy.RETAIN, DefaultI18nContext.getInstance().i18n("Retain bookmarks"))); outline.getItems() .add(keyValue(OutlinePolicy.DISCARD, DefaultI18nContext.getInstance().i18n("Discard bookmarks"))); outline.getItems().add(keyValue(OutlinePolicy.ONE_ENTRY_EACH_DOC, DefaultI18nContext.getInstance().i18n("Create one entry for each merged document"))); outline.getSelectionModel().selectFirst(); outline.setId("outlineCombo"); HBox bookmarksPolicy = new HBox(new Label(DefaultI18nContext.getInstance().i18n("Bookmarks handling:")), outline); bookmarksPolicy.getStyleClass().addAll(Style.VITEM.css()); bookmarksPolicy.getStyleClass().addAll(Style.HCONTAINER.css()); getStyleClass().addAll(Style.CONTAINER.css()); getChildren().addAll(this.containsForms, this.blankIfOdd, bookmarksPolicy); }