List of usage examples for javafx.scene.control Button setCursor
public final void setCursor(Cursor value)
From source file:dpfmanager.shell.interfaces.gui.fragment.wizard.Wizard1Fragment.java
private void addCheckBox(String id, String name, String path, boolean selected, boolean delete) { HBox hbox = new HBox(); hbox.setAlignment(Pos.CENTER_LEFT);// ww w .ja v a2 s. c o m CheckBox chk = new CheckBox(name); chk.setId(id); chk.getStyleClass().add("checkreport"); chk.setSelected(selected); chk.setEllipsisString(" ... "); chk.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS); chk.setTooltip(new Tooltip(path)); hbox.getChildren().add(chk); // EDIT Button edit = new Button(); edit.getStyleClass().addAll("edit-img", "action-img-16"); edit.setCursor(Cursor.HAND); edit.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { String iso = chk.getId(); String path = null; if (iso.startsWith("external")) { iso = chk.getText(); path = iso; } else if (chk.getId().startsWith("config")) { iso = chk.getId().replace("config", ""); path = DPFManagerProperties.getIsosDir() + "/" + iso; } controller.editIso(iso, path); } }); hbox.getChildren().add(edit); HBox.setMargin(edit, new Insets(0, 0, 0, 10)); // DELETE if (delete) { Button icon = new Button(); icon.getStyleClass().addAll("delete-img", "action-img-16"); icon.setCursor(Cursor.HAND); icon.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (chk.getId().startsWith("external")) { // Only from gui vboxRadios.getChildren().remove(hbox); } else if (chk.getId().startsWith("config")) { // From system String name = chk.getId().replace("config", ""); File file = new File(DPFManagerProperties.getIsosDir() + "/" + name); if (file.exists() && file.isFile() && acceptDelete(file)) { file.delete(); vboxRadios.getChildren().remove(hbox); } } } }); hbox.getChildren().add(icon); HBox.setMargin(icon, new Insets(0, 0, 0, 10)); } vboxRadios.getChildren().add(hbox); }
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. j a v 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; } }); }