Java Code Examples for javafx.scene.control.Button#setPrefHeight()

The following examples show how to use javafx.scene.control.Button#setPrefHeight() . 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: StateCell.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
private Button createButton(final String icon, final String tooltip, final ScanAction action)
{
    final Button button = new Button();
    button.setMinSize(ButtonBase.USE_PREF_SIZE, ButtonBase.USE_PREF_SIZE);
    button.setPrefHeight(20);
    button.setGraphic(ImageCache.getImageView(StateCell.class, icon));
    button.setTooltip(new Tooltip(tooltip));
    button.setOnAction(event ->
    {
        try
        {
            action.perform(getTableRow().getItem().id.get());
        }
        catch (Exception ex)
        {
            logger.log(Level.WARNING, "Failed: " + tooltip, ex);
        }
    });
    return button;
}
 
Example 2
Source File: BreakingNewsDemoView.java    From htm.java-examples with GNU Affero General Public License v3.0 6 votes vote down vote up
public SegmentedButtonBar createShowLogButton(VBox vBox) {
    Button logButton = new Button("Show Activity");
    logButton.getStyleClass().add("only");
    logButton.setStyle("-fx-font-size: 10; -fx-padding: 4 12 4 12; -fx-height: 10;");
    logButton.setPrefHeight(10);
    logButton.setPrefWidth(150);
    vBox.widthProperty().addListener((v, o, n) -> {
        logButton.setLayoutX(n.doubleValue() / 2.0 - 75);
    });
    logButton.setOnAction(e -> {
        flipStateProperty.set(state = state == FlipState.ON_FRONT ? FlipState.ON_BACK : FlipState.ON_FRONT);
        logButton.setText(state == FlipState.ON_FRONT ? "Show Activity" : "Show Fingerprints");
    });
    
    SegmentedButtonBar buttonBar3 = new SegmentedButtonBar();
    buttonBar3.getChildren().addAll(logButton);
    buttonBar3.setPrefHeight(10);
    
    return buttonBar3;
}
 
Example 3
Source File: AttributeEditorPanel.java    From constellation with Apache License 2.0 5 votes vote down vote up
private Button createLoadMoreButton(final VBox parent, final AttributeData attribute) {
    final Button loadMoreButton = new Button("Load all data");
    loadMoreButton.setPrefHeight(CELL_HEIGHT);
    loadMoreButton.setOnAction((ActionEvent t) -> {
        final Object[] moreData = topComponent.getMoreData(attribute);
        final ObservableList<Object> listData = FXCollections.observableArrayList();
        listData.addAll(moreData);

        final ListView<Object> newList = createListView(attribute, listData);
        parent.setPrefHeight(parent.getHeight() - loadMoreButton.getHeight());
        parent.getChildren().clear();
        parent.getChildren().add(newList);
    });
    return loadMoreButton;
}
 
Example 4
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static Button getIconButton(GlyphIcons icon, String styleClass, String iconSize) {
    if (icon.fontFamily().equals(MATERIAL_DESIGN_ICONS)) {
        Button iconButton = MaterialDesignIconFactory.get().createIconButton(icon,
                "", iconSize, null, ContentDisplay.CENTER);
        iconButton.setId("icon-button");
        iconButton.getGraphic().getStyleClass().add(styleClass);
        iconButton.setPrefWidth(20);
        iconButton.setPrefHeight(20);
        iconButton.setPadding(new Insets(0));
        return iconButton;
    } else {
        throw new IllegalArgumentException("Not supported icon type");
    }
}
 
Example 5
Source File: RichTextDemo.java    From RichTextFX with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Button createButton(String styleClass, Runnable action, String toolTip) {
    Button button = new Button();
    button.getStyleClass().add(styleClass);
    button.setOnAction(evt -> {
        action.run();
        area.requestFocus();
    });
    button.setPrefWidth(25);
    button.setPrefHeight(25);
    if (toolTip != null) {
        button.setTooltip(new Tooltip(toolTip));
    }
    return button;
}
 
Example 6
Source File: RefImplToolBar.java    From FXMaps with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Creates and returns the control for loading maps
 * @return  the control for loading stored maps
 */
public GridPane getMapControl() {
    GridPane gp = new GridPane();
    gp.setPadding(new Insets(5, 5, 5, 5));
    gp.setHgap(5);
    gp.setVgap(5);
    
    Button gpxLoader = getGPXLoadControl();
    gpxLoader.setPrefHeight(15);
    
    Label l = new Label("Select or enter map name:");
    l.setFont(Font.font(l.getFont().getFamily(), 12));
    l.setTextFill(Color.WHITE);
    
    Button add = new Button("Add");
    add.disableProperty().set(true);
    add.setOnAction(e -> mapCombo.valueProperty().set(mapCombo.getEditor().getText()));
    
    Button clr = new Button("Erase map");
    clr.disableProperty().set(true);
    clr.setOnAction(e -> map.eraseMap());
    
    Button del = new Button("Delete map");
    del.disableProperty().set(true);
    del.setOnAction(e -> {
        map.clearMap();
        map.deleteMap(mapCombo.getEditor().getText());
        mapCombo.getItems().remove(mapCombo.getEditor().getText());
        mapCombo.getSelectionModel().clearSelection();
        mapCombo.getEditor().clear();
        map.setMode(Mode.NORMAL);
        mapChooser.fire();
        map.setOverlayVisible(true);
        routeChooser.setDisable(true);
    });
    
    mapCombo.getEditor().textProperty().addListener((v, o, n) -> {
        if(mapCombo.getEditor().getText() != null && mapCombo.getEditor().getText().length() > 0) {
            add.disableProperty().set(false);
            if(map.getMapStore().getMap(mapCombo.getEditor().getText()) != null) {
                clr.disableProperty().set(false);
                del.disableProperty().set(false);
            }else{
                clr.disableProperty().set(true);
                del.disableProperty().set(true);
            }
        }else{
            add.disableProperty().set(true);
            clr.disableProperty().set(true);
            del.disableProperty().set(true);
        }
    });
    
    gp.add(gpxLoader, 0, 0, 2, 1);
    gp.add(new Separator(), 0, 1, 2, 1);
    gp.add(l, 0, 2, 2, 1);
    gp.add(mapCombo, 0, 3, 3, 1);
    gp.add(add, 3, 3);
    gp.add(clr, 4, 3);
    gp.add(del, 5, 3);
    
    return gp;
}