2011-08-30 3 views
2

이것은 모두 my last question으로 대답해야합니다. 당신이 내 마지막 질문을 보면JavaFX 2 : 테이블 : 데이터를 업데이트 한 후 디스플레이 업데이트

, 당신은

public static class ContactOptions { 

    private final StringProperty one; 
    private final StringProperty two; 
    private final StringProperty three; 
    private final StringProperty four; 

    ContactOptions(String col1, String col2, String col3, String col4) { 
     this.one = new StringProperty(col1); 
     this.two = new StringProperty(col2); 
     this.three = new StringProperty(col3); 
     this.four = new StringProperty(col4); 
    } 

    public String getOne() { 
     return one.get(); 
    } 

    public String getTwo() { 
     return two.get(); 
    } 

    public String getThree() { 
     return three.get(); 
    } 

    public String getFour() { 
     return four.get(); 
    } 
} 

어떻게 내가 ContactOptions.one.set를 실행 한 후 GUI 업데이트받을 수 있나요 내 테이블의 네 개의 컬럼에 해당하는 네 개의 필드를 포함하는, 내 수업을 볼 것인가?

아래로 스크롤하여 백업하면 업데이트됩니다. 스크롤하지 않고 어떻게 업데이트 할 수 있습니까?

은 또한 당신이 사용하는 자바 FX 2.0의 빌드 https://forums.oracle.com/forums/thread.jspa?threadID=2275725

답변

2

아마 당신은 아래의 방법 중 하나를 사용합니다.

updateTableRow(TableRow tableRow) 

이 TableCell과 관련된 TableRow를 업데이트합니다.

updateTableView(TableView tv) 

이 TableCell과 연결된 TableView를 업데이트합니다.

(http://docs.oracle.com/javafx/2.0/api/javafx/scene/control/TableCell.html에서)

그러나 나는 당신이 이미 업데이트가 원활하게 작동하려면, 각 속성을 초기화하고 xxxProperty 방법을 추가해야합니다

+0

예,이 항목을 처리했습니다. 그러나 그러한 방법을 사용하지 마십시오. 내가 필요한 것처럼 보입니다. – Dorothy

1

에서이 물어? 내가 묻는 이유는 최근에 테이블이 바뀌었고 당신이 최신 버전을 사용하고 있는지 확인하기 위해서입니다. 이 테이블 셀과 관련된

updateTableColumn(TableColumn col) 

업데이트 TableColumn의 :

2

이 문제를) 처리했다 생각 :

private final StringProperty one = new SimpleIntegerProperty(); 

public StringProperty oneProperty() { 
    return one; 
} 

을 내 자신의 경험에 따라 xxxProperty 메서드가 실행되지 않으므로 "myOne"또는 "myONE"과 같은 대문자로 된 속성 이름을 사용하지 마십시오.

관련 문제