Example usage for javafx.scene.control Button setMinHeight

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

Introduction

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

Prototype

public final void setMinHeight(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// ww w.  j av  a 2  s.c o m
        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;
        }
    });
}