本文整理汇总了Java中javafx.scene.control.TextField.setPrefColumnCount方法的典型用法代码示例。如果您正苦于以下问题:Java TextField.setPrefColumnCount方法的具体用法?Java TextField.setPrefColumnCount怎么用?Java TextField.setPrefColumnCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.TextField
的用法示例。
在下文中一共展示了TextField.setPrefColumnCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GoogleEntryReminderItem
import javafx.scene.control.TextField; //导入方法依赖的package包/类
private GoogleEntryReminderItem(GoogleEntryReminder reminder) {
this.reminder = requireNonNull(reminder);
methodCombo = new ComboBox<>();
methodCombo.getItems().setAll(RemindMethod.values());
methodCombo.disableProperty().bind(entry.getCalendar().readOnlyProperty());
methodCombo.valueProperty().bindBidirectional(reminder.methodProperty());
methodCombo.setConverter(new StringConverter<RemindMethod>() {
@Override
public String toString(RemindMethod object) {
return object.getName();
}
@Override
public RemindMethod fromString(String string) {
for (RemindMethod method : RemindMethod.values()) {
if (method.getName().equals(string)) {
return method;
}
}
return null;
}
});
Integer minutes = reminder.getMinutes();
TimeUnit unit = TimeUnit.MINUTES;
if (minutes != null) {
if (minutes % 1440 == 0) {
unit = TimeUnit.DAYS;
minutes = minutes / 1400;
} else if (minutes % 60 == 0) {
unit = TimeUnit.HOURS;
minutes = minutes / 60;
}
}
valueTxt = new TextField();
valueTxt.disableProperty().bind(entry.getCalendar().readOnlyProperty());
valueTxt.setPrefColumnCount(5);
valueTxt.setText(minutes == null ? "" : minutes.toString());
valueTxt.textProperty().addListener(obs -> updateMinutes());
unitCombo = new ComboBox<>();
unitCombo.getItems().setAll(TimeUnit.MINUTES, TimeUnit.HOURS, TimeUnit.DAYS);
unitCombo.disableProperty().bind(entry.getCalendar().readOnlyProperty());
unitCombo.setValue(unit);
unitCombo.valueProperty().addListener(obs -> updateMinutes());
removeIcon = new Label();
removeIcon.getStyleClass().add("button-icon");
removeIcon.setGraphic(new FontAwesome().create(FontAwesome.Glyph.TRASH_ALT));
removeIcon.setOnMouseClicked(evt -> removeReminder(reminder));
removeIcon.disableProperty().bind(entry.getCalendar().readOnlyProperty());
HBox.setHgrow(removeIcon, Priority.NEVER);
setAlignment(Pos.CENTER_LEFT);
getChildren().addAll(methodCombo, valueTxt, unitCombo, removeIcon);
getStyleClass().add("notification-item");
}
示例2: createIPTextField
import javafx.scene.control.TextField; //导入方法依赖的package包/类
private void createIPTextField() {
id = new TextField();
addTextFieldCharLimit(id, 4);
id.setPrefColumnCount(4);
}