나는 같은 클래스가 유사한 상황으로자바 FX 2] 선택은
Rendering a POJO with JavaFX 2
,210하지만 선택 바
편집을 사용 :이 내 상황
이다 : 그것의 열 중 하나에 내가 myClass가 유형의 객체에서 문자열을 설정할 필요가 어디 있으며, toString를 사용하여있는 tableView이() 메소드를 호출합니다.
나는이 방법을 사용하는 것을 시도했다 (여기서 myClass가 -> CustomInternalWindow 클래스)
public static class Indicators{
private final SimpleStringProperty tool_col;
private final SimpleStringProperty chart_col;
private final SimpleStringProperty pane_col;
private final SimpleBooleanProperty on_col;
private Indicators(String tl, CustomInternalWindow chrt, String pne, Boolean sel){
this.tool_col = new SimpleStringProperty (tl);
if (chrt == null) {
this.chart_col = null;
}
else {
this.chart_col = new SimpleStringProperty (chrt.toString());
}
this.pane_col = new SimpleStringProperty (pne);
this.on_col = new SimpleBooleanProperty (sel);
}
public String getTool(){
return tool_col.get();
}
public void setTool(String tl){
tool_col.set(tl);
}
...
public SimpleBooleanProperty onProperty() {
return on_col;
}
public SimpleStringProperty toolProperty(){
return tool_col;
}
public SimpleStringProperty chartProperty(){
return chart_col;
}
public SimpleStringProperty paneProperty(){
return pane_col;
}
}
및
tablecolumnFrame.setCellFactory(new Callback<TableColumn<Indicators, CustomInternalWindow>, TableCell<Indicators, CustomInternalWindow>>(){
@Override
public TableCell<Indicators, CustomInternalWindow> call(TableColumn<Indicators, CustomInternalWindow> param){
TableCell<Indicators, CustomInternalWindow> cell = new TableCell<Indicators, CustomInternalWindow>(){
@Override
public void updateItem(CustomInternalWindow item, boolean empty) {
super.updateItem(item, empty);
if (item != null) {
ChoiceBox<CustomInternalWindow> choiceChart = new ChoiceBox<>(newprojectx.NewProjectXController.windowsPlotted);
choiceChart.setConverter(new CustomInternaWindowStringConverter());
choiceChart.getSelectionModel().select(item);
choiceChart.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<CustomInternalWindow>() {
@Override
public void changed(
final ObservableValue<? extends CustomInternalWindow> ov, final CustomInternalWindow oldValue, final CustomInternalWindow newValue) {
if (!isEditing()) {
final TableView table = getTableView();
if (table != null) {
table.edit(getTableRow().getIndex(), getTableColumn());
}
}
commitEdit(newValue);
}
});
setGraphic(choiceChart);
}
}
};
return cell;
}
});
하지만 windowsPlotted 목록에서 문자열을 표시 할 수 없습니다입니다
업데이트 : 나는이 문제에 여전히 고심하고있다. 어떤 도움이나 제안도 정말 고맙게 생각한다.
좀 더 자세한 코드 내 질문을 편집, 난 여전히 심지어 귀하의 회신 후 문제가 –