小编Pau*_*los的帖子

JavaFX:CheckBoxTableCell在用户检查checkBox时获取ActionEvent

我想在用户选中或取消选中tableView中的复选框时触发方法或操作.当用户使用checkBox时,不会触发coursData.addListener(...).

这是我编译的代码,窗口显示带有复选框的tableView.

package testCheckBox2;

import javafx.application.Application;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonBase;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.CheckBoxTableCell;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;


public class CheckBoxTableCellTest extends Application {

  private TableView<cours> tableView;

  public ObservableList<cours> coursData ;//= FXCollections.observableArrayList();
  @Override

  public void start(Stage primaryStage) {

      this.tableView = new TableView<cours>();
      final TableColumn<cours, String> Cours = new TableColumn<cours, String>("Cours");
      final TableColumn<cours, …
Run Code Online (Sandbox Code Playgroud)

java checkbox javafx tableview

3
推荐指数
1
解决办法
8860
查看次数

标签 统计

checkbox ×1

java ×1

javafx ×1

tableview ×1