Example usage for javafx.scene.layout HBox setSpacing

List of usage examples for javafx.scene.layout HBox setSpacing

Introduction

In this page you can find the example usage for javafx.scene.layout HBox setSpacing.

Prototype

public final void setSpacing(double value) 

Source Link

Usage

From source file:RemoveDuplicateFiles.java

public static Scene makeScene() {
    //Setup the main BorderPane (Holds all the things)
    BorderPane backPane = new BorderPane();

    //----------------------------------------------------------------------
    //Setup the Main Menu Buttons & Pane
    sortFilesButton = new Button("Sort Files");
    batchRenameButton = new Button("Batch Rename Files");

    HBox mainButtons = new HBox();
    mainButtons.setPadding(new Insets(15, 12, 15, 12));
    mainButtons.setSpacing(10);
    mainButtons.setStyle(BUTTON_STYLE);/*from   ww  w. ja  v a  2s .  co m*/

    mainButtons.getChildren().add(sortFilesButton);
    mainButtons.getChildren().add(batchRenameButton);

    backPane.setTop(mainButtons);

    //----------------------------------------------------------------------
    //Setup the filetypes box
    HBox fileTypePane = GUIFactories.getFileTypeBox(fileTypes);
    backPane.setBottom(fileTypePane);

    //----------------------------------------------------------------------
    //Setup the FileType Pre-set Buttons
    VBox preSets = GUIFactories.getPresets(fileTypes);
    backPane.setRight(preSets);

    //----------------------------------------------------------------------
    //Setup the center GridPane
    rmvButton = new Button("Remove Duplicates");
    actionTarget = new Text();

    GridPane grid = GUIFactories.getCenterPane(address, rmvButton, actionTarget);
    backPane.setCenter(grid);

    //----------------------------------------------------------------------
    Scene scene = new Scene(backPane, WIDTH, HEIGHT);
    return 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  ww w. j a  v  a2s. com
 * @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: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  . ja  va2s .c o m
    arc.setStroke(Color.BLACK);
    arc.setType(ArcType.ROUND);

    HBox box = new HBox(arc);

    box.setSpacing(10);
    box.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(box);
    stage.setScene(scene);
    stage.setTitle("Test");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Button btn = new Button("A big button");

    Rectangle rect = new Rectangle(100, 50);
    rect.setFill(Color.WHITE);//from  w w  w.j  a v  a  2 s.c  o m
    rect.setStrokeWidth(1);
    rect.setStroke(Color.BLACK);

    HBox root = new HBox();
    root.setSpacing(20);
    root.getChildren().addAll(btn, rect);

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Resizable Nodes");
    stage.show();

    System.out.println("btn.isResizable(): " + btn.isResizable());
    System.out.println("rect.isResizable(): " + rect.isResizable());
}

From source file:Main.java

@Override
public void start(Stage stage) {
    ArcTo arcTo = new ArcTo();
    arcTo.setX(20);/*from ww w .j a va  2  s.c  o m*/
    arcTo.setY(30);

    arcTo.setRadiusX(30);
    arcTo.setRadiusY(30);

    Path path = new Path(new MoveTo(0, 0), new VLineTo(100), new HLineTo(100), new VLineTo(50), arcTo);
    HBox box = new HBox(path);

    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) {
    Arc arc = new Arc(0, 0, 50, 100, 0, 90);
    arc.setFill(Color.GRAY);//from   w w  w .j a  v  a2 s  .  co  m
    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);
    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);//from  w  w  w  .j  ava  2 s  .c  om
    stage.setTitle("2D Shapes using Path and SVGPath Classes");
    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   w w w. ja va  2s.c o m
    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) {
    Text t1 = new Text("Drop Shadow!");
    t1.setFont(Font.font(24));/*from w ww . ja va  2s .  c  o m*/
    t1.setEffect(new DropShadow());

    Text t2 = new Text("Blur!");
    t2.setFont(Font.font(24));
    t2.setEffect(new BoxBlur());

    Text t3 = new Text("Glow!");
    t3.setFont(Font.font(24));
    t3.setEffect(new Glow());

    Text t4 = new Text("Bloom!");
    t4.setFont(Font.font("Arial", FontWeight.BOLD, 24));
    t4.setFill(Color.WHITE);
    t4.setEffect(new Bloom(0.10));

    Rectangle rect = new Rectangle(100, 30, Color.GREEN);
    StackPane spane = new StackPane(rect, t4);

    HBox root = new HBox(t1, t2, t3, spane);
    root.setSpacing(20);

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Applying Effects");
    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);/*w w w .j  a 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();
}