本文整理匯總了Java中javafx.scene.control.Label.setLabelFor方法的典型用法代碼示例。如果您正苦於以下問題:Java Label.setLabelFor方法的具體用法?Java Label.setLabelFor怎麽用?Java Label.setLabelFor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.Label
的用法示例。
在下文中一共展示了Label.setLabelFor方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initComponents
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<Number>() {
@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));
}