2012-07-04 110 views

回答

21

在這裏你去

tableView.setPlaceholder(new Text("Your localized text here")); 
+0

哈,它是一個節點:)我正在尋找一些字符串setter或本地化捆綁..謝謝! – Kamil

1

沒有的東西在表視圖中顯示,如果沒有數據

.table-row-cell:empty { 
    -fx-background-color: lightyellow; 
} 

.table-row-cell:empty .table-cell { 
    -fx-border-width: 0px; 
} 
1

繼JavaFX的建議,它會是更好地執行這樣的

Model.java

class Model { 
    private final ObjectProperty<Text> placeholderProperty; 

    Model(ResourceBundle resourceBundle) { 

     placeholderProperty = new SimpleObjectProperty<>(new Text(resourceBundle.getString("placeholderTextFromLocalizationProperties"))); 
    } 

    ... 

    ObjectProperty<Text> placeholderProperty() { 
     return placeholderProperty; 
    } 
} 

Controller.java

class Controller implements Initializable { 
    private Model model; 
    @FXML 
    private TableView tableView; 
    ... 
    @Override 
    public void initialize(URL url, ResourceBundle resourceBundle) { 
     model = new Model(resourceBundle); 

     tableView.setPlaceholder(model.placeholderProperty().get()); 

    } 
    ... 
} 

當您即將更改本地化時,您需要的一切就是編輯屬性文件。