import javafx.scene.control.Label; //导入方法依赖的package包/类
private void initComponents() {
container = new TilePane();
//container.setVgap(5);
//container.setHgap(5);
container.setPrefColumns(8);
lblTitle = new Label(title);
lblName = new Label("Name: ");
lblLecture = new Label("Lecture: ");
lblSemester = new Label("Semester: ");
lblPoints = new Label("Max. Points: ");
dispName = new Label();
dispName.textProperty().bind(catName);
dispName.getStyleClass().add("display");
dispLecture = new Label();
dispLecture.textProperty().bind(catLecture);
dispLecture.getStyleClass().add("display");
dispSemester = new Label();
dispSemester.textProperty().bind(catSemester);
dispSemester.getStyleClass().add("display");
dispPoints = new Label();
dispPoints.textProperty().bindBidirectional(maxPoints, new StringConverter() {
@Override
public String toString(Number object) {
return StringUtils.prettyPrint(object != null ? object.doubleValue() : 0);
}
@Override
public Number fromString(String string) {
try {
return Double.valueOf(string);
} catch (NumberFormatException ex) {
EditorView.LOGGER_UI.warn("Caught NumberFormatException and setting value to 0.", ex);
return 0;
}
}
});
dispPoints.getStyleClass().add("display");
lblName.setLabelFor(dispName);
lblLecture.setLabelFor(dispLecture);
lblSemester.setLabelFor(dispSemester);
lblPoints.setLabelFor(dispPoints);
container.setAlignment(Pos.CENTER_LEFT);
setSpacing(10);
setPadding(new Insets(10));
}