Example usage for javafx.scene.control Button setPrefHeight

List of usage examples for javafx.scene.control Button setPrefHeight

Introduction

In this page you can find the example usage for javafx.scene.control Button setPrefHeight.

Prototype

public final void setPrefHeight(double value) 

Source Link

Usage

From source file:dpfmanager.shell.interfaces.gui.component.report.ReportsView.java

public void addDeleteIcon() {
    colDelete.setCellFactory(new Callback<TableColumn<ReportRow, String>, TableCell<ReportRow, String>>() {
        @Override//from   w  w w  . java  2 s .  com
        public TableCell<ReportRow, String> call(TableColumn<ReportRow, String> param) {
            TableCell<ReportRow, String> cell = new TableCell<ReportRow, String>() {
                @Override
                public void updateItem(String item, boolean empty) {
                    super.updateItem(item, empty);
                    if (!empty && item != null) {
                        String path = getModel().getItemById(item).getDeletePath();

                        HBox box = new HBox();
                        box.setSpacing(3);
                        box.setAlignment(Pos.CENTER_LEFT);

                        Button icon = new Button();
                        icon.setMinHeight(20);
                        icon.setPrefHeight(20);
                        icon.setMaxHeight(20);
                        icon.setMinWidth(20);
                        icon.setPrefWidth(20);
                        icon.setMaxWidth(20);
                        icon.getStyleClass().addAll("delete-img", "periodic-img");
                        icon.setCursor(Cursor.HAND);
                        icon.setOnMouseClicked(new EventHandler<MouseEvent>() {
                            @Override
                            public void handle(MouseEvent event) {
                                // Delete report
                                File file = new File(path);
                                File dir = new File(file.getParent());
                                try {
                                    FileUtils.deleteDirectory(dir);
                                } catch (IOException e) {
                                    e.printStackTrace();
                                }

                                getModel().removeItem(item);
                                addData();
                            }
                        });

                        box.getChildren().add(icon);
                        setGraphic(box);
                    }
                }
            };
            return cell;
        }
    });
}

From source file:AudioPlayer3.java

private Button createOpenButton() {
    final Button openButton = new Button();
    openButton.setId("openButton");
    openButton.setOnAction(new OpenHandler());
    openButton.setPrefWidth(32);/*from w ww.  j  ava2  s . c  om*/
    openButton.setPrefHeight(32);
    return openButton;
}