Java Code Examples for javafx.scene.layout.FlowPane#setVgap()

The following examples show how to use javafx.scene.layout.FlowPane#setVgap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AwesomeFontDemo.java    From bisq with GNU Affero General Public License v3.0 8 votes vote down vote up
@Override
public void start(Stage primaryStage) {
    FlowPane flowPane = new FlowPane();
    flowPane.setStyle("-fx-background-color: #ddd;");
    flowPane.setHgap(2);
    flowPane.setVgap(2);
    List<AwesomeIcon> values = new ArrayList<>(Arrays.asList(AwesomeIcon.values()));
    values.sort((o1, o2) -> o1.name().compareTo(o2.name()));
    for (AwesomeIcon icon : values) {
        Label label = new Label();
        Button button = new Button(icon.name(), label);
        button.setStyle("-fx-background-color: #fff;");
        AwesomeDude.setIcon(label, icon, "12");
        flowPane.getChildren().add(button);
    }

    primaryStage.setScene(new Scene(flowPane, 1200, 950));
    primaryStage.show();
}
 
Example 2
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static Tuple2<Label, FlowPane> addTopLabelFlowPane(GridPane gridPane,
                                                          int rowIndex,
                                                          String title,
                                                          double top,
                                                          double bottom) {
    FlowPane flowPane = new FlowPane();
    flowPane.setPadding(new Insets(10, 10, 10, 10));
    flowPane.setVgap(10);
    flowPane.setHgap(10);
    final Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, flowPane, top);

    GridPane.setMargin(topLabelWithVBox.second, new Insets(top + Layout.FLOATING_LABEL_DISTANCE,
            0, bottom, 0));

    return new Tuple2<>(topLabelWithVBox.first, flowPane);
}
 
Example 3
Source File: MaterialDesignIconDemo.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void start(Stage primaryStage) {
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setFitToWidth(true);

    FlowPane flowPane = new FlowPane();
    flowPane.setStyle("-fx-background-color: #ddd;");
    flowPane.setHgap(2);
    flowPane.setVgap(2);
    List<MaterialDesignIcon> values = new ArrayList<>(Arrays.asList(MaterialDesignIcon.values()));
    values.sort(Comparator.comparing(Enum::name));
    for (MaterialDesignIcon icon : values) {
        Button button = MaterialDesignIconFactory.get().createIconButton(icon, icon.name());
        flowPane.getChildren().add(button);
    }

    scrollPane.setContent(flowPane);

    primaryStage.setScene(new Scene(scrollPane, 1200, 950));
    primaryStage.show();
}
 
Example 4
Source File: CheckBoxDemo.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) {

    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);

    CheckBox cb = new CheckBox("CheckBox");
    JFXCheckBox jfxCheckBox = new JFXCheckBox("JFX CheckBox");
    JFXCheckBox customJFXCheckBox = new JFXCheckBox("Custom JFX CheckBox");
    customJFXCheckBox.getStyleClass().add("custom-jfx-check-box");

    main.getChildren().add(cb);
    main.getChildren().add(jfxCheckBox);
    main.getChildren().add(customJFXCheckBox);

    StackPane pane = new StackPane();
    pane.getChildren().add(main);
    StackPane.setMargin(main, new Insets(100));
    pane.setStyle("-fx-background-color:WHITE");

    final Scene scene = new Scene(pane, 600, 200);
    scene.getStylesheets().add(CheckBoxDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX CheckBox Demo ");
    stage.setScene(scene);
    stage.setResizable(false);
    stage.show();

}
 
Example 5
Source File: DatePickerDemo.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) {

    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);


    DatePicker datePicker = new DatePicker();

    main.getChildren().add(datePicker);
    JFXDatePicker datePickerFX = new JFXDatePicker();

    main.getChildren().add(datePickerFX);
    datePickerFX.setPromptText("pick a date");
    JFXTimePicker blueDatePicker = new JFXTimePicker();
    blueDatePicker.setDefaultColor(Color.valueOf("#3f51b5"));
    blueDatePicker.setOverLay(true);
    main.getChildren().add(blueDatePicker);


    StackPane pane = new StackPane();
    pane.getChildren().add(main);
    StackPane.setMargin(main, new Insets(100));
    pane.setStyle("-fx-background-color:WHITE");

    final Scene scene = new Scene(pane, 400, 700);
    final ObservableList<String> stylesheets = scene.getStylesheets();
    stylesheets.addAll(MainDemo.class.getResource("/css/jfoenix-fonts.css").toExternalForm(),
                       MainDemo.class.getResource("/css/jfoenix-design.css").toExternalForm());
    stage.setTitle("JFX Date Picker Demo");
    stage.setScene(scene);
    stage.show();

}
 
Example 6
Source File: ButtonDemo.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) {
    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);

    main.getChildren().add(new Button("Java Button"));
    JFXButton jfoenixButton = new JFXButton("JFoenix Button");
    main.getChildren().add(jfoenixButton);

    JFXButton button = new JFXButton("RAISED BUTTON");
    button.getStyleClass().add("button-raised");
    main.getChildren().add(button);

    JFXButton button1 = new JFXButton("DISABLED");
    button1.setDisable(true);
    main.getChildren().add(button1);

    StackPane pane = new StackPane();
    pane.getChildren().add(main);
    StackPane.setMargin(main, new Insets(100));
    pane.setStyle("-fx-background-color:WHITE");

    final Scene scene = new Scene(pane, 800, 200);
    scene.getStylesheets().add(ButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX Button Demo");
    stage.setScene(scene);
    stage.show();
}
 
Example 7
Source File: IssueCard.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private FlowPane createDetailsPane() {
    FlowPane detailsPane = new FlowPane();
    detailsPane.setMaxWidth(CARD_WIDTH);
    detailsPane.setPrefWrapLength(CARD_WIDTH);
    detailsPane.setHgap(3);
    detailsPane.setVgap(3);
    return detailsPane;
}
 
Example 8
Source File: AssigneePickerDialog.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private FlowPane createAssignedUserPane() {
    FlowPane assignedUserPane = new FlowPane();
    assignedUserPane.setPadding(new Insets(5, 5, 5, 5));
    assignedUserPane.setHgap(3);
    assignedUserPane.setVgap(5);
    assignedUserPane.setStyle("-fx-border-radius: 3;");
    assignedUserPane.setId(IdGenerator.getAssigneePickerAssignedUserPaneId());
    return assignedUserPane;
}
 
Example 9
Source File: LabelPickerDialog.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private FlowPane createGroupPane(Insets padding) {
    FlowPane group = new FlowPane();
    group.setHgap(5);
    group.setVgap(5);
    group.setPadding(padding);
    return group;
}
 
Example 10
Source File: IssuePickerDialog.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private FlowPane createRepoPane(Insets padding) {
    FlowPane repo = new FlowPane();
    repo.setHgap(5);
    repo.setVgap(5);
    repo.setPadding(padding);
    return repo;
}
 
Example 11
Source File: CObjectArrayField.java    From Open-Lowcode with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Node getNode(
		PageActionManager actionmanager,
		CPageData inputdata,
		Window parentwindow,
		TabPane[] parenttabpanes,
		CollapsibleNode nodetocollapsewhenactiontriggered) {
	logger.fine("built node CObjectArrayField " + this.name);
	this.actionmanager = actionmanager;
	if (this.inlinefeeding) {
		inputdata.addInlineActionDataRef(this.feedinginlineactionoutputdata);

	}
	this.tooltip = new Tooltip("click to open object\nShift+click to unlink object.");
	HBox thispane = new HBox();

	if (label != null)
		if (label.length() > 0) {
			Label thislabel = new Label(label);
			if (helper != null)
				if (helper.length() > 0)
					thislabel.setTooltip(new Tooltip(helper));
			thislabel.setFont(
					Font.font(thislabel.getFont().getName(), FontPosture.ITALIC, thislabel.getFont().getSize()));
			thislabel.setMinWidth(120);
			thislabel.setWrapText(true);
			thislabel.setMaxWidth(120);
			thispane.getChildren().add(thislabel);
		}

	datapane = new FlowPane();
	boolean nolabel = true;
	if (label != null)
		if (label.length() > 0) {
			FlowPane flowdatapane = new FlowPane();
			thispane.setAlignment(Pos.TOP_LEFT);
			flowdatapane.setPrefWrapLength(400);
			// for object workflow tasks.
			flowdatapane.setVgap(4);
			flowdatapane.setHgap(8);
			this.datapane = flowdatapane;
			nolabel = false;
		}

	if (nolabel) {
		HBox boxdatapane = new HBox();
		thispane.setAlignment(Pos.CENTER_LEFT);
		boxdatapane.setAlignment(Pos.CENTER_LEFT);
		this.datapane = boxdatapane;
	}

	// this is to keep the widget tiny when used as right of title

	thiselementarray = getExternalContent(inputdata, datareference);
	if (objectatendoffielddata != null)
		dataatendoffielddata = objectatendoffielddata.getNode(actionmanager, inputdata, parentwindow,
				parenttabpanes,nodetocollapsewhenactiontriggered);
	refreshDisplay();

	thispane.getChildren().add(datapane);

	return thispane;
}
 
Example 12
Source File: RipplerDemo.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
@Override
public void start(Stage stage) {

    //TODO drop shadow changes the width and height thus need to be considered
    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);

    Label label = new Label("Click Me");
    label.setStyle(FX_BACKGROUND_COLOR_WHITE);
    label.setPadding(new Insets(20));
    JFXRippler rippler = new JFXRippler(label);
    rippler.setEnabled(false);
    main.getChildren().add(rippler);

    label.setOnMousePressed((e) -> {
        if (counter == 5) {
            step = -1;
        } else if (counter == 0) {
            step = 1;
        }
        JFXDepthManager.setDepth(label, counter += step % JFXDepthManager.getLevels());
    });

    Label l1 = new Label("TEST");
    l1.setStyle(FX_BACKGROUND_COLOR_WHITE);
    l1.setPadding(new Insets(20));
    JFXRippler rippler1 = new JFXRippler(l1);
    main.getChildren().add(rippler1);
    JFXDepthManager.setDepth(rippler1, 1);

    Label l2 = new Label("TEST1");
    l2.setStyle(FX_BACKGROUND_COLOR_WHITE);
    l2.setPadding(new Insets(20));
    JFXRippler rippler2 = new JFXRippler(l2);
    main.getChildren().add(rippler2);
    JFXDepthManager.setDepth(rippler2, 2);


    Label l3 = new Label("TEST2");
    l3.setStyle(FX_BACKGROUND_COLOR_WHITE);
    l3.setPadding(new Insets(20));
    JFXRippler rippler3 = new JFXRippler(l3);
    main.getChildren().add(rippler3);
    JFXDepthManager.setDepth(rippler3, 3);

    Label l4 = new Label("TEST3");
    l4.setStyle(FX_BACKGROUND_COLOR_WHITE);
    l4.setPadding(new Insets(20));
    JFXRippler rippler4 = new JFXRippler(l4);
    main.getChildren().add(rippler4);
    JFXDepthManager.setDepth(rippler4, 4);

    Label l5 = new Label("TEST4");
    l5.setStyle(FX_BACKGROUND_COLOR_WHITE);
    l5.setPadding(new Insets(20));
    JFXRippler rippler5 = new JFXRippler(l5);
    main.getChildren().add(rippler5);
    JFXDepthManager.setDepth(rippler5, 5);

    StackPane pane = new StackPane();
    pane.getChildren().add(main);
    StackPane.setMargin(main, new Insets(100));
    pane.setStyle("-fx-background-color:WHITE");

    final Scene scene = new Scene(pane, 600, 400);

    stage.setTitle("JavaFX Ripple effect and shadows ");
    stage.setScene(scene);
    stage.setResizable(false);
    stage.show();

}
 
Example 13
Source File: AnimationDemo.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
@Override
public void start(Stage stage) {

    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);

    StackPane colorPane = new StackPane();
    colorPane.setStyle(STYLE);
    colorPane.getStyleClass().add("red-500");
    main.getChildren().add(colorPane);

    StackPane colorPane1 = new StackPane();
    colorPane1.setStyle(STYLE);
    colorPane1.getStyleClass().add("blue-500");

    StackPane placeHolder = new StackPane(colorPane1);
    placeHolder.setStyle(STYLE);
    main.getChildren().add(placeHolder);


    StackPane colorPane2 = new StackPane();
    colorPane2.setStyle(STYLE);
    colorPane2.getStyleClass().add("green-500");
    main.getChildren().add(colorPane2);

    StackPane colorPane3 = new StackPane();
    colorPane3.setStyle(STYLE);
    colorPane3.getStyleClass().add("yellow-500");
    main.getChildren().add(colorPane3);


    StackPane colorPane4 = new StackPane();
    colorPane4.setStyle(STYLE);
    colorPane4.getStyleClass().add("purple-500");
    main.getChildren().add(colorPane4);


    StackPane wizard = new StackPane();
    wizard.getChildren().add(main);
    StackPane.setMargin(main, new Insets(100));
    wizard.setStyle("-fx-background-color:WHITE");

    StackPane nextPage = new StackPane();

    StackPane newPlaceHolder = new StackPane();
    newPlaceHolder.setStyle("-fx-background-radius:50; -fx-max-width:50; -fx-max-height:50;");
    nextPage.getChildren().add(newPlaceHolder);
    StackPane.setAlignment(newPlaceHolder, Pos.TOP_LEFT);


    JFXHamburger h4 = new JFXHamburger();
    h4.setMaxSize(40, 40);
    HamburgerBackArrowBasicTransition burgerTask3 = new HamburgerBackArrowBasicTransition(h4);
    burgerTask3.setRate(-1);
    h4.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
        burgerTask3.setRate(burgerTask3.getRate() * -1);
        burgerTask3.play();
    });
    nextPage.getChildren().add(h4);
    StackPane.setAlignment(h4, Pos.TOP_LEFT);
    StackPane.setMargin(h4, new Insets(10));


    JFXNodesAnimation<FlowPane, StackPane> animation = new FlowPaneStackPaneJFXNodesAnimation(main,
                                                                                              nextPage,
                                                                                              wizard,
                                                                                              colorPane1);

    colorPane1.setOnMouseClicked((click) -> animation.animate());

    final Scene scene = new Scene(wizard, 800, 200);
    final ObservableList<String> stylesheets = scene.getStylesheets();
    stylesheets.addAll(ButtonDemo.class.getResource("/css/jfoenix-design.css").toExternalForm(),
                       ButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX Button Demo");
    stage.setScene(scene);
    stage.show();

}
 
Example 14
Source File: HamburgerDemo.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
@Override
public void start(Stage stage) {


    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);

    JFXHamburger h1 = new JFXHamburger();
    HamburgerSlideCloseTransition burgerTask = new HamburgerSlideCloseTransition(h1);
    burgerTask.setRate(-1);
    h1.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
        burgerTask.setRate(burgerTask.getRate() * -1);
        burgerTask.play();
    });

    JFXHamburger h2 = new JFXHamburger();
    HamburgerBasicCloseTransition burgerTask1 = new HamburgerBasicCloseTransition(h2);
    burgerTask1.setRate(-1);
    h2.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
        burgerTask1.setRate(burgerTask1.getRate() * -1);
        burgerTask1.play();
    });

    JFXHamburger h3 = new JFXHamburger();
    HamburgerBackArrowBasicTransition burgerTask2 = new HamburgerBackArrowBasicTransition(h3);
    burgerTask2.setRate(-1);
    h3.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
        burgerTask2.setRate(burgerTask2.getRate() * -1);
        burgerTask2.play();
    });

    JFXHamburger h4 = new JFXHamburger();
    HamburgerNextArrowBasicTransition burgerTask3 = new HamburgerNextArrowBasicTransition(h4);
    burgerTask3.setRate(-1);
    h4.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
        burgerTask3.setRate(burgerTask3.getRate() * -1);
        burgerTask3.play();
    });


    main.getChildren().add(h1);
    main.getChildren().add(h2);
    main.getChildren().add(h3);
    main.getChildren().add(h4);

    StackPane pane = new StackPane();
    pane.getChildren().add(main);
    StackPane.setMargin(main, new Insets(60));
    pane.setStyle("-fx-background-color:WHITE");

    final Scene scene = new Scene(pane, 400, 200);
    scene.getStylesheets().add(HamburgerDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX Burgers Demo :) ");
    stage.setScene(scene);
    stage.setResizable(false);

    stage.show();

}