Java Code Examples for javafx.scene.control.ColorPicker#setOnShowing()

The following examples show how to use javafx.scene.control.ColorPicker#setOnShowing() . 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: ColorTableCell.java    From old-mzmine3 with GNU General Public License v2.0 6 votes vote down vote up
public ColorTableCell(TableColumn<T, Color> column) {
  colorPicker = new ColorPicker();
  colorPicker.editableProperty().bind(column.editableProperty());
  colorPicker.disableProperty().bind(column.editableProperty().not());
  colorPicker.setOnShowing(event -> {
    final TableView<T> tableView = getTableView();
    tableView.getSelectionModel().select(getTableRow().getIndex());
    tableView.edit(tableView.getSelectionModel().getSelectedIndex(), column);
  });
  colorPicker.valueProperty().addListener((observable, oldValue, newValue) -> {
    if (isEditing()) {
      commitEdit(newValue);
    }
  });
  setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
}
 
Example 2
Source File: ColorTableCell.java    From mzmine2 with GNU General Public License v2.0 6 votes vote down vote up
public ColorTableCell(TableColumn<T, Color> column) {
    colorPicker = new ColorPicker();
    colorPicker.editableProperty().bind(column.editableProperty());
    colorPicker.disableProperty().bind(column.editableProperty().not());
    colorPicker.setOnShowing(event -> {
        final TableView<T> tableView = getTableView();
        tableView.getSelectionModel().select(getTableRow().getIndex());
        tableView.edit(tableView.getSelectionModel().getSelectedIndex(),
                column);
    });
    colorPicker.valueProperty()
            .addListener((observable, oldValue, newValue) -> {
                commitEdit(newValue);
            });
    setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
}
 
Example 3
Source File: ColorTableCell.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
public ColorTableCell(TableColumn<T, Color> column) {
  colorPicker = new ColorPicker();
  colorPicker.editableProperty().bind(column.editableProperty());
  colorPicker.disableProperty().bind(column.editableProperty().not());
  colorPicker.setOnShowing(event -> {
    final TableView<T> tableView = getTableView();
    tableView.getSelectionModel().select(getTableRow().getIndex());
    tableView.edit(tableView.getSelectionModel().getSelectedIndex(), column);
  });
  colorPicker.valueProperty().addListener((observable, oldValue, newValue) -> {
    commitEdit(newValue);
  });
  setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
}