tablecell中的java Progressbar和标签
我需要放入一个表格单元格、一个标签和进度条
对于progressbar,我使用了:
@FXML
private TableView tableView;
@FXML
private TableColumn columTabela;
@FXML
private TableColumn columSituacao;
private List<Tabela> lista = new ArrayList<Tabela>();
public List<Tabela> getLista() {
return lista;
}
public void setLista(List<Tabela> lista) {
this.lista = lista;
}
private void test() {
getLista().add(new Tabela("test", -1.0));
getLista().add(new Tabela("test1", null));
columTabela.setCellValueFactory(new PropertyValueFactory<Tabela, String>("nome"));
columSituacao.setCellValueFactory(new PropertyValueFactory<Tabela, Double> ("progresso"));
columSituacao.setCellFactory(ProgressBarTableCell.forTableColumn());
tableView.getItems().addAll(FXCollections.observableArrayList(lista));
但现在有必要在单元格内添加一个beyond progressbar标签,无法找到解决方案
类别表:
公共类Tabela{
private String nome;
private Double progresso;
public Tabela(String nome, Double progresso) {
this.nome = nome;
this.progresso = progresso;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public Double getProgresso() {
return progresso;
}
public void setProgresso(Double progresso) {
this.progresso = progresso;
}
}
当我的进程运行时,表的单元格中将有一个progressbar,标签将在其中更改
我感谢你的帮助
# 1 楼答案
您需要编写自己的单元工厂:
然后用它,