javafx.scene.layout.HBox Java Examples

The following examples show how to use javafx.scene.layout.HBox. 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 Project: marathonv5   Author: jalian-systems   File: CheckListFormNode.java    License: Apache License 2.0 8 votes vote down vote up
private VBox createDescriptionField() {
    VBox descriptionFieldBox = new VBox();
    TextArea descriptionArea = new TextArea();
    descriptionArea.setPrefRowCount(4);
    descriptionArea.textProperty().addListener((observable, oldValue, newValue) -> {
        fireContentChanged();
        checkList.setDescription(descriptionArea.getText());
    });
    descriptionArea.setEditable(mode.isSelectable());
    descriptionFieldBox.getChildren().addAll(new Label("Description"), descriptionArea);
    HBox.setHgrow(descriptionArea, Priority.ALWAYS);
    VBox.setMargin(descriptionFieldBox, new Insets(5, 10, 5, 5));
    descriptionArea.setText(checkList.getDescription());
    HBox.setHgrow(descriptionArea, Priority.ALWAYS);
    HBox.setHgrow(descriptionFieldBox, Priority.ALWAYS);
    return descriptionFieldBox;
}
 
Example #2
Source Project: SmartCity-ParkingManagement   Author: TechnionYP5777   File: PmMap.java    License: Apache License 2.0 6 votes vote down vote up
protected Marker createMarker(final LatLong lat, final String title) {
	final MarkerOptions options = new MarkerOptions();
	options.position(lat).title(title).visible(true);
	final Marker $ = new MyMarker(options, title, lat);
	markers.add($);
	fromLocation.getItems().add(title);
	toLocation.getItems().add(title);
	final HBox hbox = new HBox();
	hbox.setPadding(new Insets(8, 5, 8, 5));
	hbox.setSpacing(8);
	final Label l = new Label(title);
	final Button btn = new Button("remove");
	btn.setOnAction(λ -> {
		map.removeMarker($);
		markerVbox.getChildren().remove(hbox);
		fromLocation.getItems().remove(title);
		toLocation.getItems().remove(title);
	});
	btns.add(btn);
	hbox.getChildren().addAll(l, btn);
	VBox.setMargin(hbox, new Insets(0, 0, 0, 8));
	markerVbox.getChildren().add(hbox);
	return $;

}
 
Example #3
Source Project: constellation   Author: constellation-app   File: TransactionTypeNodeProvider.java    License: Apache License 2.0 6 votes vote down vote up
private VBox addFilter() {
    filterText.setPromptText("Filter transaction types");
    final ToggleGroup toggleGroup = new ToggleGroup();
    startsWithRb.setToggleGroup(toggleGroup);
    startsWithRb.setPadding(new Insets(0, 0, 0, 5));
    startsWithRb.setSelected(true);
    final RadioButton containsRadioButton = new RadioButton("Contains");
    containsRadioButton.setToggleGroup(toggleGroup);
    containsRadioButton.setPadding(new Insets(0, 0, 0, 5));

    toggleGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> {
        populateTree();
    });

    filterText.textProperty().addListener((observable, oldValue, newValue) -> {
        populateTree();
    });

    final HBox headerBox = new HBox(new Label("Filter: "), filterText, startsWithRb, containsRadioButton);
    headerBox.setAlignment(Pos.CENTER_LEFT);
    headerBox.setPadding(new Insets(5));

    final VBox box = new VBox(schemaLabel, headerBox, treeView);
    VBox.setVgrow(treeView, Priority.ALWAYS);
    return box;
}
 
Example #4
Source Project: bisq   Author: bisq-network   File: FormBuilder.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
public static Tuple3<Label, TextField, Button> addTopLabelTextFieldButton(GridPane gridPane,
                                                                          int rowIndex,
                                                                          String title,
                                                                          String buttonTitle,
                                                                          double top) {

    TextField textField = new BisqTextField();
    textField.setEditable(false);
    textField.setMouseTransparent(true);
    textField.setFocusTraversable(false);
    Button button = new AutoTooltipButton(buttonTitle);
    button.setDefaultButton(true);

    HBox hBox = new HBox();
    hBox.setSpacing(10);
    hBox.getChildren().addAll(textField, button);
    HBox.setHgrow(textField, Priority.ALWAYS);

    final Tuple2<Label, VBox> labelVBoxTuple2 = addTopLabelWithVBox(gridPane, rowIndex, title, hBox, top);

    return new Tuple3<>(labelVBoxTuple2.first, textField, button);
}
 
Example #5
Source Project: trex-stateless-gui   Author: cisco-system-traffic-generator   File: ConfigTreeItem.java    License: Apache License 2.0 6 votes vote down vote up
private void initTreeItemValue() {
    HBox itemContainer = new HBox();
    itemContainer.setSpacing(5d);
    itemContainer.getChildren().add(createLabel());

    Region spacing = new Region();
    spacing.setMaxHeight(0d);
    HBox.setHgrow(spacing, Priority.ALWAYS);
    itemContainer.getChildren().add(spacing);

    if (configNode.isRemovable()) {
        itemContainer.getChildren().add(createRemoveButton());
    }

    this.control = createControl();
    if (control != null) {
        itemContainer.getChildren().add(control);
    }

    setValue(itemContainer);
}
 
Example #6
Source Project: java-ml-projects   Author: jesuino   File: App.java    License: Apache License 2.0 6 votes vote down vote up
private Parent buildUI() {
	fc = new FileChooser();
	fc.getExtensionFilters().clear();
	ExtensionFilter jpgFilter = new ExtensionFilter("JPG, JPEG images", "*.jpg", "*.jpeg", "*.JPG", ".JPEG");
	fc.getExtensionFilters().add(jpgFilter);
	fc.setSelectedExtensionFilter(jpgFilter);
	fc.setTitle("Select a JPG image");
	lstLabels = new ListView<>();
	lstLabels.setPrefHeight(200);
	Button btnLoad = new Button("Select an Image");
	btnLoad.setOnAction(e -> validateUrlAndLoadImg());

	HBox hbBottom = new HBox(10, btnLoad);
	hbBottom.setAlignment(Pos.CENTER);

	loadedImage = new ImageView();
	loadedImage.setFitWidth(300);
	loadedImage.setFitHeight(250);
	
	Label lblTitle = new Label("Label image using TensorFlow");
	lblTitle.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, 40));
	VBox root = new VBox(10,lblTitle, loadedImage, new Label("Results:"), lstLabels, hbBottom);
	root.setAlignment(Pos.TOP_CENTER);
	return root;
}
 
Example #7
Source Project: PDF4Teachers   Author: ClementGre   File: TextElement.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void setupMenu(){

	NodeMenuItem item1 = new NodeMenuItem(new HBox(), TR.tr("Supprimer"), false);
	item1.setAccelerator(new KeyCodeCombination(KeyCode.DELETE));
	item1.setToolTip(TR.tr("Supprime cet élément. Il sera donc retiré de l'édition."));
	NodeMenuItem item2 = new NodeMenuItem(new HBox(), TR.tr("Dupliquer"), false);
	item2.setToolTip(TR.tr("Crée un second élément identique à celui-ci."));
	NodeMenuItem item3 = new NodeMenuItem(new HBox(), TR.tr("Ajouter aux éléments précédents"), false);
	item3.setToolTip(TR.tr("Ajoute cet élément à la liste des éléments précédents."));
	NodeMenuItem item4 = new NodeMenuItem(new HBox(), TR.tr("Ajouter aux éléments Favoris"), false);
	item4.setToolTip(TR.tr("Ajoute cet élément à la liste des éléments favoris."));
	menu.getItems().addAll(item1, item2, item4, item3);
	NodeMenuItem.setupMenu(menu);

	item1.setOnAction(e -> delete());
	item2.setOnAction(e -> cloneOnDocument());
	item3.setOnAction(e -> TextTreeView.addSavedElement(this.toNoDisplayTextElement(TextTreeSection.LAST_TYPE, true)));
	item4.setOnAction(e -> TextTreeView.addSavedElement(this.toNoDisplayTextElement(TextTreeSection.FAVORITE_TYPE, true)));
}
 
Example #8
Source Project: MSPaintIDE   Author: MSPaintIDE   File: SettingNumberField.java    License: MIT License 6 votes vote down vote up
public SettingNumberField() {
    getStyleClass().add("theme-text");
    setStyle("-fx-padding: 10px 0");
    label.getStyleClass().add("theme-text");
    numberField.getStyleClass().add("theme-text");


    Node spacer = getHSpacer(10);
    HBox.setHgrow(label, Priority.NEVER);
    HBox.setHgrow(numberField, Priority.NEVER);
    HBox.setHgrow(spacer, Priority.NEVER);

    label.setPrefHeight(25);
    getChildren().add(label);
    getChildren().add(spacer);
    getChildren().add(numberField);
    numberField.textProperty().addListener(((observable, oldValue, newValue) -> SettingsManager.getInstance().setSetting(settingProperty.get(), newValue.isEmpty() ? 0 : Integer.valueOf(newValue))));
}
 
Example #9
Source Project: arma-dialog-creator   Author: kayler-renslow   File: ImageValueEditor.java    License: MIT License 6 votes vote down vote up
public ImageValueEditor() {
	HBox.setHgrow(tfFilePath, Priority.ALWAYS);
	tfFilePath.setEditable(false);
	btnChooseImage.setOnAction(new EventHandler<ActionEvent>() {
		@Override
		public void handle(ActionEvent event) {
			FileChooser fc = new FileChooser();
			fc.setTitle(bundle.getString("ValueEditors.ImageValueEditor.locate_image"));
			fc.getExtensionFilters().addAll(ADCStatic.IMAGE_FILE_EXTENSIONS);
			fc.setInitialDirectory(Workspace.getWorkspace().getWorkspaceDirectory());
			File chosenFile = fc.showOpenDialog(ArmaDialogCreator.getPrimaryStage());
			if (chosenFile == null) {
				return;
			}
			chooseImage(chosenFile);
		}
	});
}
 
Example #10
Source Project: chart-fx   Author: GSI-CS-CO   File: CheckedNumberTextField.java    License: Apache License 2.0 6 votes vote down vote up
public CheckedNumberTextField(final double initialValue) {
    super(Double.toString(initialValue));

    final ValidationSupport support = new ValidationSupport();
    final Validator<String> validator = (final Control control, final String value) -> {
        final boolean condition = value == null || !(value.matches(CheckedNumberTextField.NUMBER_REGEX) || CheckedNumberTextField.isNumberInfinity(value));

        // change text colour depending on validity as a number
        setStyle(condition ? "-fx-text-inner-color: red;" : "-fx-text-inner-color: black;");
        return ValidationResult.fromMessageIf(control, "not a number", Severity.ERROR, condition);
    };
    support.registerValidator(this, true, validator);

    snappedTopInset();
    snappedBottomInset();
    HBox.setHgrow(this, Priority.ALWAYS);
    VBox.setVgrow(this, Priority.ALWAYS);
}
 
Example #11
Source Project: jmonkeybuilder   Author: JavaSaBr   File: LodLevelPropertyControl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
@FxThread
protected void createComponents(@NotNull HBox container) {
    super.createComponents(container);

    levelComboBox = new ComboBox<>();
    levelComboBox.setCellFactory(param -> new LodLevelCell());
    levelComboBox.setButtonCell(new LodLevelCell());
    levelComboBox.setEditable(false);
    levelComboBox.prefWidthProperty()
            .bind(widthProperty().multiply(CONTROL_WIDTH_PERCENT));

    FxControlUtils.onSelectedItemChange(levelComboBox, this::updateLevel);

    FxUtils.addClass(levelComboBox,
            CssClasses.PROPERTY_CONTROL_COMBO_BOX);

    FxUtils.addChild(container, levelComboBox);
}
 
Example #12
Source Project: phoenicis   Author: PhoenicisOrg   File: RepositoriesPanelSkin.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Creates a container for the refresh button
 *
 * @return A container with the refresh button
 */
private HBox createRefreshButtonContainer() {
    final Label refreshRepositoriesLabel = new Label(
            tr("Fetch updates from the repositories to retrieve latest script versions"));
    refreshRepositoriesLabel.getStyleClass().add("repositories-refresh-label");

    HBox.setHgrow(refreshRepositoriesLabel, Priority.ALWAYS);

    final Button refreshRepositoriesButton = new Button(tr("Refresh Repositories"));
    refreshRepositoriesButton.setOnAction(
            event -> Optional.ofNullable(getControl().getOnRepositoryRefresh()).ifPresent(Runnable::run));

    final HBox container = new HBox(refreshRepositoriesLabel, refreshRepositoriesButton);

    container.getStyleClass().add("repositories-refresh-container");

    return container;
}
 
Example #13
Source Project: jmonkeybuilder   Author: JavaSaBr   File: FloatPropertyControl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
@FxThread
protected void createComponents(@NotNull HBox container) {
    super.createComponents(container);

    valueField = new FloatTextField();
    valueField.prefWidthProperty()
        .bind(widthProperty().multiply(CONTROL_WIDTH_PERCENT));

    FxControlUtils.onValueChange(valueField, this::updateValue);
    FxControlUtils.onFocusChange(valueField, this::applyOnLostFocus);

    FxUtils.addClass(valueField,
            CssClasses.PROPERTY_CONTROL_COMBO_BOX);

    FxUtils.addChild(container, valueField);
}
 
Example #14
Source Project: phoebus   Author: ControlSystemStudio   File: CellUtiles.java    License: Eclipse Public License 1.0 6 votes vote down vote up
static <T> void startEdit(final Cell<T> cell,
                          final StringConverter<T> converter,
                          final HBox hbox,
                          final Node graphic,
                          final TextField textField) {
    textField.setText(getItemText(cell, converter));
    cell.setText(null);

    if (graphic != null) {
        hbox.getChildren().setAll(graphic, textField);
        cell.setGraphic(hbox);
    } else {
        cell.setGraphic(textField);
    }

    textField.selectAll();

    // requesting focus so that key input can immediately go into the
    // TextField (see RT-28132)
    textField.requestFocus();
}
 
Example #15
Source Project: tutorials   Author: eugenp   File: CameraStream.java    License: MIT License 5 votes vote down vote up
public void start(Stage stage) throws Exception {
    OpenCV.loadShared();
    capture=  new VideoCapture(0); // The number is the ID of the camera
    ImageView imageView = new ImageView();
    HBox hbox = new HBox(imageView);
    Scene scene = new Scene(hbox);
    stage.setScene(scene);
    stage.show();
    new AnimationTimer(){
        @Override
        public void handle(long l) {
            imageView.setImage(getCapture());
        }
    }.start();
}
 
Example #16
Source Project: strongbox   Author: schibsted   File: SecretEntryView.java    License: Apache License 2.0 5 votes vote down vote up
private void outputShared() {
    HBox name = KeyValueHBox.createTableRow("Name:", rawSecretEntry.secretIdentifier.name);
    HBox version = KeyValueHBox.createTableRow("Version:", rawSecretEntry.version.toString());

    Label filler = new Label(" ");
    filler.setMinHeight(27);

    HBox state = KeyValueHBox.createTableRow("State:", rawSecretEntry.state.toString());
    HBox notBefore = KeyValueHBox.createTableRow("Not Before:", FormattedTimestamp.toHumanReadable(rawSecretEntry.notBefore));
    HBox notAfter = KeyValueHBox.createTableRow("Not After:", FormattedTimestamp.toHumanReadable(rawSecretEntry.notAfter));

    Label title = new Label("Entry");

    currentSecretView.getChildren().setAll(title, editRow, filler, name, version, state, notBefore, notAfter);
}
 
Example #17
Source Project: phoebus   Author: ControlSystemStudio   File: SpinnerDemo.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void start(final Stage stage)
{
    final Label label = new Label("Demo:");

    SpinnerValueFactory<Double> svf = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, 1000);
    Spinner<Double> spinner = new Spinner<>();
    spinner.setValueFactory(svf);
    spinner.editorProperty().getValue().setStyle("-fx-text-fill:" + "black");
    spinner.editorProperty().getValue().setBackground(
            new Background(new BackgroundFill(Color.AZURE, CornerRadii.EMPTY, Insets.EMPTY)));


    //spinner.getStyleClass().add(Spinner.STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL);
    //int x = spinner.getStyleClass().indexOf(Spinner.STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL);
    //if (x > 0) spinner.getStyleClass().remove(x);

    spinner.setEditable(true);
    spinner.setPrefWidth(80);

    spinner.valueProperty().addListener((prop, old, value) ->
    {
        System.out.println("Value: " + value);
    });

    final HBox root = new HBox(label, spinner);

    final Scene scene = new Scene(root, 800, 700);
    stage.setScene(scene);
    stage.setTitle("Spinner Demo");

    stage.show();
}
 
Example #18
Source Project: constellation   Author: constellation-app   File: ReportVisualisation.java    License: Apache License 2.0 5 votes vote down vote up
public ReportVisualisation() {
    final HBox pluginsReportBox = new HBox();
    final Label pluginsRunLabel = new Label("Plugins Run: ");
    pluginsRunLabel.setStyle(JavafxStyleManager.CSS_FONT_WEIGHT_BOLD);
    this.pluginsRunValue = new Label();
    pluginsRunValue.setWrapText(true);
    pluginsReportBox.getChildren().addAll(pluginsRunLabel, pluginsRunValue);

    final HBox numberOfResultsReportBox = new HBox();
    final Label numberOfResultsLabel = new Label("Number of Results: ");
    numberOfResultsLabel.setStyle(JavafxStyleManager.CSS_FONT_WEIGHT_BOLD);
    this.numberOfResultsValue = new Label();
    numberOfResultsValue.setWrapText(true);
    numberOfResultsReportBox.getChildren().addAll(numberOfResultsLabel, numberOfResultsValue);

    final HBox aggregationMethodReportBox = new HBox();
    final Label aggregationMethodLabel = new Label("Aggregation Method: ");
    aggregationMethodLabel.setStyle(JavafxStyleManager.CSS_FONT_WEIGHT_BOLD);
    this.aggregationMethodValue = new Label();
    aggregationMethodValue.setWrapText(true);
    aggregationMethodReportBox.getChildren().addAll(aggregationMethodLabel, aggregationMethodValue);

    final HBox exceptionsReportBox = new HBox();
    final Label exceptionsLabel = new Label("Exceptions: ");
    exceptionsLabel.setStyle(JavafxStyleManager.CSS_FONT_WEIGHT_BOLD);
    this.exceptionsValue = new Label();
    exceptionsValue.setWrapText(true);
    exceptionsReportBox.getChildren().addAll(exceptionsLabel, exceptionsValue);

    this.report = new VBox(pluginsReportBox, numberOfResultsReportBox, aggregationMethodReportBox, exceptionsReportBox);
}
 
Example #19
Source Project: marathonv5   Author: jalian-systems   File: ColorButtonSample.java    License: Apache License 2.0 5 votes vote down vote up
public ColorButtonSample() {
    HBox hBox = new HBox();
    hBox.setSpacing(5);
    for(int i=0; i<7; i++) {
        Button b = new Button("Color");
        b.setStyle("-fx-base: rgb("+(10*i)+","+(20*i)+","+(10*i)+");");
        hBox.getChildren().add(b);
    }
    HBox hBox2 = new HBox();
    hBox2.setSpacing(5);
    hBox2.setTranslateY(30);
    Button red = new Button("Red");
    red.setStyle("-fx-base: red;");
    Button orange = new Button("Orange");
    orange.setStyle("-fx-base: orange;");
    Button yellow = new Button("Yellow");
    yellow.setStyle("-fx-base: yellow;");
    Button green = new Button("Green");
    green.setStyle("-fx-base: green;");
    Button blue = new Button("Blue");
    blue.setStyle("-fx-base: rgb(30,170,255);");
    Button indigo = new Button("Indigo");
    indigo.setStyle("-fx-base: blue;");
    Button violet = new Button("Violet");
    violet.setStyle("-fx-base: purple;");
    hBox2.getChildren().add(red);
    hBox2.getChildren().add(orange);
    hBox2.getChildren().add(yellow);
    hBox2.getChildren().add(green);
    hBox2.getChildren().add(blue);
    hBox2.getChildren().add(indigo);
    hBox2.getChildren().add(violet);

    VBox vBox = new VBox(20);
    vBox.getChildren().addAll(hBox,hBox2);
    getChildren().add(vBox);
}
 
Example #20
Source Project: bisq   Author: bisq-network   File: NewTradeProtocolLaunchWindow.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
@NotNull
private VBox getFeatureBox(String title, String description, String imageId, String url) {
    Label featureTitle = new Label(title);
    featureTitle.setTextAlignment(TextAlignment.LEFT);
    featureTitle.getStyleClass().add("news-feature-headline");

    ImageView sectionScreenshot = new ImageView();
    sectionScreenshot.setId(imageId);

    HBox imageContainer = new HBox(sectionScreenshot);
    imageContainer.getStyleClass().add("news-feature-image");

    Label featureDescription = new Label(description);
    featureDescription.setTextAlignment(TextAlignment.LEFT);
    featureDescription.getStyleClass().add("news-feature-description");
    featureDescription.setWrapText(true);

    HyperlinkWithIcon learnMore = new ExternalHyperlink(Res.get("shared.learnMore"), "highlight");
    learnMore.setOnAction(event -> {

        if (DontShowAgainLookup.showAgain(GUIUtil.OPEN_WEB_PAGE_KEY)) {
            hide();
            GUIUtil.openWebPage(url, true, () -> {
                this.rowIndex = -1;
                this.show();
            });
        } else {
            GUIUtil.openWebPage(url);
        }
    });

    VBox vBox = new VBox(featureTitle, imageContainer, featureDescription, learnMore);
    vBox.setAlignment(Pos.CENTER_LEFT);
    vBox.setSpacing(20);
    vBox.setMaxWidth(300);
    return vBox;
}
 
Example #21
Source Project: phoebus   Author: ControlSystemStudio   File: WebBrowserDemo.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public BrowserWithToolbar(String url)
{
    super(url);
    locationChanged(null, null, webEngine.getLocation());
    //assemble toolbar controls
    backButton.setOnAction(this::handleBackButton);
    foreButton.setOnAction(this::handleForeButton);
    stop.setOnAction(this::handleStop);
    refresh.setOnAction(this::handleRefresh);
    addressBar.setOnAction(this::handleGo);
    go.setOnAction(this::handleGo);

    foreButton.setDisable(true);
    backButton.setDisable(true);

    addressBar.setEditable(true);
    //addressBar.setOnShowing(this::handleShowing);
    webEngine.locationProperty().addListener(this::locationChanged);
    history.getEntries().addListener(this::entriesChanged);

    for (int i = 0; i < controls.length; i++)
    {
        Control control = controls[i];
        if (control instanceof ButtonBase)
        {
            HBox.setHgrow(control, Priority.NEVER);
            ((ButtonBase)control).setGraphic(new ImageView(new Image(ModelPlugin.class.getResource("/icons/browser/" + iconFiles[i]).toExternalForm())));
        }
        else
            HBox.setHgrow(control, Priority.ALWAYS);
    }

    //add toolbar component
    toolbar = new HBox(controls);
    toolbar.getStyleClass().add("browser-toolbar");
    getChildren().add(toolbar);
}
 
Example #22
Source Project: milkman   Author: warmuuh   File: ResponseComponent.java    License: MIT License 5 votes vote down vote up
private void addStatusInformation(CompletableFuture<Map<String, String>> statusInformations) {
	statusDisplay.getChildren().clear();
	statusInformations.thenAccept(stats ->  Platform.runLater(() -> {
		for (Entry<String, String> entry : stats.entrySet()) {
			Label name = new Label(entry.getKey() + ":");
			Label value = new Label(entry.getValue());
			value.getStyleClass().add("emphasized");
			statusDisplay.getChildren().add(new HBox(name, value));	
		}
	}));
	
}
 
Example #23
Source Project: marathonv5   Author: jalian-systems   File: NodePropertiesSample.java    License: Apache License 2.0 5 votes vote down vote up
private HBox createRadioButtons() {
    //creates a radio buttons, for each rectangle 2 buttons with action .toFront() and toBack()
    ToggleGroup tg = new ToggleGroup();
    
    VBox vBox1 = new VBox();
    vBox1.setSpacing(5);
    vBox1.setLayoutY(6);
    vBox1.getChildren().addAll(
            createRadioButton(rectA, "A.toFront()", true, tg),
            createRadioButton(rectB, "B.toFront()", true, tg),
            createRadioButton(rectC, "C.toFront()", true, tg)
            );

    VBox vBox2 = new VBox();
    vBox2.setSpacing(5);
    vBox2.setLayoutY(6);
    vBox2.getChildren().addAll(
            createRadioButton(rectA, "A.toBack()", false, tg),
            createRadioButton(rectB, "B.toBack()", false, tg),
            createRadioButton(rectC, "C.toBack()", false, tg)
            );

    HBox hBox = new HBox();
    hBox.setSpacing(10);
    hBox.getChildren().addAll(vBox1, vBox2);
    return hBox;
}
 
Example #24
Source Project: jmonkeybuilder   Author: JavaSaBr   File: StringBasedArrayPropertyControl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@FxThread
protected void createComponents(@NotNull HBox container) {
    super.createComponents(container);

    valueField = new TextField();
    valueField.setOnKeyReleased(this::updateValue);
    valueField.prefWidthProperty()
            .bind(widthProperty().multiply(CONTROL_WIDTH_PERCENT));

    FxUtils.addClass(valueField,
            CssClasses.PROPERTY_CONTROL_COMBO_BOX);

    FxUtils.addChild(container, valueField);
}
 
Example #25
Source Project: oim-fx   Author: oimchat   File: MenuFrame.java    License: MIT License 5 votes vote down vote up
private void init() {
	this.getScene().getStylesheets().add(this.getClass().getResource("/classics/css/base.css").toString());
	this.getRootPane().getStylesheets().add(this.getClass().getResource("/classics/css/base.css").toString());
	
	
	this.setCenter(rootPane);
	this.setTitle("组件测试");
	this.setWidth(380);
	this.setHeight(600);
	this.setRadius(10);

	VBox topBox = new VBox();
	topBox.setPrefHeight(50);
	rootPane.setTop(topBox);
	BorderPane borderPane = new BorderPane();

	rootPane.setCenter(borderPane);

	HBox hBox = new HBox();

	borderPane.setTop(hBox);
	borderPane.setCenter(componentBox);

	componentBox.setOnContextMenuRequested(a -> {
		///menu.show(MenuFrame.this, a.getX(), a.getY());
	});
}
 
Example #26
Source Project: pdfsam   Author: torakiki   File: PreferenceRadioButtonTest.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void start(Stage stage) {
    Scene scene = new Scene(
            new HBox(new PreferenceRadioButton(BooleanUserPreference.SMART_OUTPUT, "select", false, userContext)));
    stage.setScene(scene);
    stage.show();
}
 
Example #27
Source Project: phoebus   Author: ControlSystemStudio   File: ToolbarHelper.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/** @return 'Spring', spacer that fills available space */
public static Node createSpring()
{
    final Region sep = new Region();
    HBox.setHgrow(sep, Priority.ALWAYS);
    return sep;
}
 
Example #28
Source Project: jace   Author: badvision   File: JaceUIController.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void startDragEvent(MediaEntry media) {
    List<MediaConsumer> consumers = getMediaConsumers();
    drivePanel = new HBox();
    consumers.stream()
            .filter((consumer) -> (consumer.isAccepted(media, media.files.get(0))))
            .forEach((consumer) -> {
                Label icon = consumer.getIcon().orElse(null);
                if (icon == null) {
                    return;
                }
                icon.setTextFill(Color.WHITE);
                icon.setPadding(new Insets(2.0));
                drivePanel.getChildren().add(icon);
                icon.setOnDragOver(event -> {
                    event.acceptTransferModes(TransferMode.ANY);
                    event.consume();
                });
                icon.setOnDragDropped(event -> {
                    System.out.println("Dropping media on " + icon.getText());
                    try {
                        computer.pause();
                        consumer.insertMedia(media, media.files.get(0));
                        computer.resume();
                        event.setDropCompleted(true);
                        event.consume();
                    } catch (IOException ex) {
                        Logger.getLogger(JaceUIController.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    endDragEvent();
                });
            });
    stackPane.getChildren().add(drivePanel);
    drivePanel.setLayoutX(10);
    drivePanel.setLayoutY(10);
}
 
Example #29
Source Project: medusademo   Author: HanSolo   File: KpiDashboard.java    License: Apache License 2.0 5 votes vote down vote up
private HBox getLegendBox(final Color COLOR, final String TEXT, final double HEIGHT) {
    Rectangle rect = new Rectangle(20, HEIGHT);
    rect.setFill(COLOR);
    Label label = new Label(TEXT);
    label.setFont(Font.font(10));

    HBox hBox = new HBox(rect, label);
    hBox.setAlignment(Pos.CENTER);
    hBox.setSpacing(2);
    return hBox;
}
 
Example #30
Source Project: WorkbenchFX   Author: dlsc-software-consulting-gmbh   File: TabSkin.java    License: Apache License 2.0 5 votes vote down vote up
private void initializeParts() {
  closeIconShape = new StackPane();
  closeIconShape.getStyleClass().add("shape");
  closeBtn = new Button("", closeIconShape);
  closeBtn.getStyleClass().addAll("icon", "close-icon");

  nameLbl = new Label();
  nameLbl.getStyleClass().add("tab-name-lbl");

  controlBox = new HBox();
  controlBox.getStyleClass().add("tab-box");
}