2012-07-04 39 views

Trả lời

21

Ở đây bạn đi

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

Ha, đó là nút :) và tôi đang tìm kiếm một số chuỗi setter hoặc gói nội địa hóa .. cảm ơn! – Kamil

1

không điều hiển thị trong xem bảng nếu không có dữ liệu

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

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

Sau JavaFX giới thiệu nó muốn được tốt hơn để thực hiện như thế này

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()); 

    } 
    ... 
} 

Khi bạn sắp thay đổi nội địa hóa mọi thứ bạn cần là chỉnh sửa tệp thuộc tính của bạn.

Các vấn đề liên quan