javafx.scene.control.TableView.setEditable()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中javafx.scene.control.TableView.setEditable()方法的一些代码示例,展示了TableView.setEditable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableView.setEditable()方法的具体详情如下:
包路径:javafx.scene.control.TableView
类名称:TableView
方法名:setEditable

TableView.setEditable介绍

暂无

代码示例

代码示例来源:origin: org.copper-engine/copper-monitoring-client

public static <T> void setupEditableBooleanColumn(TableColumn<T, Boolean> column, final ColumnBooleanAccessor<T> propertyAccessor) {
  column.getTableView().setEditable(true);
  column.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<T, Boolean>, ObservableValue<Boolean>>() {
    @Override
    public ObservableValue<Boolean> call(CellDataFeatures<T, Boolean> param) {
      return propertyAccessor.getProperty(param.getValue());
    }
  });
  column.setOnEditCommit(new EventHandler<CellEditEvent<T, Boolean>>() {
    @Override
    public void handle(CellEditEvent<T, Boolean> t) {
      propertyAccessor.getProperty(t.getRowValue()).setValue(t.getNewValue());
    }
  });
  column.setCellFactory(CheckBoxTableCell.forTableColumn(column));
  column.setEditable(true);
}

代码示例来源:origin: stackoverflow.com

);
TableView tv = new TableView(data);
tv.setEditable(true);
tv.getSelectionModel().setCellSelectionEnabled(true);

代码示例来源:origin: org.javafxdata/datafx-ui

public static <S> TableViewFactory<S> create(Class<? extends S> dataType, final ObservableList<S> items) {
  if (items == null) {
    throw new NullPointerException("items can not be null");
  }
  final TableView<S> table = new TableView<S>();
  table.setItems(items);
  table.setEditable(true);
  if (dataType == null && table.getItems().isEmpty()) {
    // we'll have to create the columns the first time the items list
    // changes, so let's hook in a listener
    InvalidationListener listener = new InvalidationListener() {
      @Override
      public void invalidated(Observable o) {
        if (!table.getItems().isEmpty()) {
          createColumns(table);
          // remove listener
          items.removeListener(this);
        }
      }
    };
    table.getItems().addListener(listener);
  } else {
    createColumns(table);
  }
  return TableViewFactory.configure(table);
}

代码示例来源:origin: org.javafxdata/datafx-cell

public static <S> TableViewFactory<S> create(Class<? extends S> dataType, final ObservableList<S> items) {
  if (items == null) {
    throw new NullPointerException("items can not be null");
  }
  final TableView<S> table = new TableView<S>();
  table.setItems(items);
  table.setEditable(true);
  if (dataType == null && table.getItems().isEmpty()) {
    // we'll have to create the columns the first time the items list
    // changes, so let's hook in a listener
    InvalidationListener listener = new InvalidationListener() {
      @Override
      public void invalidated(Observable o) {
        if (!table.getItems().isEmpty()) {
          createColumns(table);
          // remove listener
          items.removeListener(this);
        }
      }
    };
    table.getItems().addListener(listener);
  } else {
    createColumns(table);
  }
  return TableViewFactory.configure(table);
}

代码示例来源:origin: io.datafx/ui

public static <S> TableViewFactory<S> create(Class<? extends S> dataType, final ObservableList<S> items) {
  if (items == null) {
    throw new NullPointerException("items can not be null");
  }
  final TableView<S> table = new TableView<S>();
  table.setItems(items);
  table.setEditable(true);
  if (dataType == null && table.getItems().isEmpty()) {
    // we'll have to create the columns the first time the items list
    // changes, so let's hook in a listener
    InvalidationListener listener = new InvalidationListener() {
      @Override
      public void invalidated(Observable o) {
        if (!table.getItems().isEmpty()) {
          createColumns(table);
          // remove listener
          items.removeListener(this);
        }
      }
    };
    table.getItems().addListener(listener);
  } else {
    createColumns(table);
  }
  return TableViewFactory.configure(table);
}

代码示例来源:origin: org.copper-engine/copper-monitoring-client

/**
 * T Tableobject
 * Column Display Type
 */
public static <T> void setupEditableStringColumn(TableColumn<T, String> column, final ColumnStringAccessor<T> propertyAccessor) {
  column.getTableView().setEditable(true);
  column.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<T, String>, ObservableValue<String>>() {
    @Override
    public ObservableValue<String> call(CellDataFeatures<T, String> param) {
      return propertyAccessor.getProperty(param.getValue());
    }
  });
  column.setEditable(true);
  column.setOnEditCommit(new EventHandler<CellEditEvent<T, String>>() {
    @Override
    public void handle(CellEditEvent<T, String> t) {
      propertyAccessor.getProperty(t.getRowValue()).setValue(t.getNewValue());
    }
  });
  column.setCellFactory(new Callback<TableColumn<T, String>, TableCell<T, String>>() {
    @Override
    public TableCell<T, String> call(TableColumn<T, String> param) {
      return new EditingCell<T>();
    }
  });
}

代码示例来源:origin: stackoverflow.com

tv.setEditable(true);

代码示例来源:origin: stackoverflow.com

table_view.setEditable(true);
table_view.getSelectionModel().setCellSelectionEnabled(true);
table_view.getColumns().setAll(firstDataColumn, secondDataColumn);

代码示例来源:origin: stackoverflow.com

tv.setEditable(true);
tv.getColumns().addAll(tID, lastNameCol);
root.getChildren().add(tv);

代码示例来源:origin: com.aquafx-project/aquafx

table.setPrefHeight(250);
table.setPrefWidth(650);
table.setEditable(true);

代码示例来源:origin: org.jrebirth.af.showcase/todos

this.table.setEditable(true);

代码示例来源:origin: com.aquafx-project/aquafx

table.setEditable(true);

代码示例来源:origin: org.jrebirth.af.showcase/todos

this.table.setEditable(true);

相关文章