Spec-Zone .ru
спецификации, руководства, описания, API
|
public class DatePicker extends ComboBoxBase<java.time.LocalDate>
The value
property represents the
currently selected <code>LocalDate</code>. An initial date can
be set via the constructor
or by calling setValue()
. The
default value is null.
final DatePicker datePicker = new DatePicker();
datePicker.setOnAction(new EventHandler() {
public void handle(Event t) {
LocalDate date = datePicker.getValue();
System.err.println("Selected date: " + date);
}
});
The chronology
property specifies a
calendar system to be used for parsing, displaying, and choosing
dates.
The value
property is always defined in
the ISO calendar system, however, so applications based on a
different chronology may use the conversion methods provided in the
<code>Chronology</code> API to get or set the
corresponding <code>ChronoLocalDate</code> value. For
example:
LocalDate isoDate = datePicker.getValue();
ChronoLocalDate chronoDate =
((isoDate != null) ? datePicker.getChronology().date(isoDate) : null);
System.err.println("Selected date: " + chronoDate);
Type | Property and Description |
---|---|
ObjectProperty<java.time.chrono.Chronology> |
chronology
The calendar system used for parsing, displaying, and choosing
dates in the DatePicker control.
|
ObjectProperty<StringConverter<java.time.LocalDate>> |
converter
Converts the input text to an object of type LocalDate and vice
versa.
|
ObjectProperty<Callback<DatePicker,DateCell>> |
dayCellFactory
A custom cell factory can be provided to customize individual
day cells in the DatePicker popup.
|
ReadOnlyObjectProperty<TextField> |
editor
The editor for the DatePicker.
|
BooleanProperty |
showWeekNumbers
Whether the DatePicker popup should display a column showing
week numbers.
|
armed, editable, onAction, onHidden, onHiding, onShowing, onShown, promptText, showing, value
contextMenu, skin, tooltip
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
needsLayout
blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, visible
ON_HIDDEN, ON_HIDING, ON_SHOWING, ON_SHOWN
USE_COMPUTED_SIZE, USE_PREF_SIZE
Constructor and Description |
---|
DatePicker()
Creates a default DatePicker instance with a
null date value set. |
DatePicker(java.time.LocalDate localDate)
Creates a DatePicker instance and sets the
value to the given date. |
Modifier and Type | Method and Description |
---|---|
ObjectProperty<java.time.chrono.Chronology> |
chronologyProperty()
The calendar system used for parsing, displaying, and choosing
dates in the DatePicker control.
|
ObjectProperty<StringConverter<java.time.LocalDate>> |
converterProperty()
Converts the input text to an object of type LocalDate and vice
versa.
|
protected Skin<?> |
createDefaultSkin()
Create a new instance of the default skin for this control.
|
ObjectProperty<Callback<DatePicker,DateCell>> |
dayCellFactoryProperty()
A custom cell factory can be provided to customize individual
day cells in the DatePicker popup.
|
ReadOnlyObjectProperty<TextField> |
editorProperty()
The editor for the DatePicker.
|
java.time.chrono.Chronology |
getChronology()
Gets the value of the property chronology.
|
static java.util.List<CssMetaData<? extends Styleable,?>> |
getClassCssMetaData() |
java.util.List<CssMetaData<? extends Styleable,?>> |
getControlCssMetaData() |
StringConverter<java.time.LocalDate> |
getConverter()
Gets the value of the property converter.
|
Callback<DatePicker,DateCell> |
getDayCellFactory()
Gets the value of the property dayCellFactory.
|
TextField |
getEditor()
Gets the value of the property editor.
|
boolean |
isShowWeekNumbers()
Gets the value of the property showWeekNumbers.
|
void |
setChronology(java.time.chrono.Chronology value)
Sets the value of the property chronology.
|
void |
setConverter(StringConverter<java.time.LocalDate> value)
Sets the value of the property converter.
|
void |
setDayCellFactory(Callback<DatePicker,DateCell> value)
Sets the value of the property dayCellFactory.
|
void |
setShowWeekNumbers(boolean value)
Sets the value of the property showWeekNumbers.
|
BooleanProperty |
showWeekNumbersProperty()
Whether the DatePicker popup should display a column showing
week numbers.
|
arm, armedProperty, disarm, editableProperty, getOnAction, getOnHidden, getOnHiding, getOnShowing, getOnShown, getPromptText, getValue, hide, isArmed, isEditable, isShowing, onActionProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, promptTextProperty, setEditable, setOnAction, setOnHidden, setOnHiding, setOnShowing, setOnShown, setPromptText, setValue, show, showingProperty, valueProperty
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getCssMetaData, getSkin, getTooltip, getUserAgentStylesheet, isResizable, layoutChildren, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapSize, snapSpace, snapToPixelProperty, widthProperty
getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, setNeedsLayout
addEventFilter, addEventHandler, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
public final ObjectProperty<Callback<DatePicker,DateCell>> dayCellFactoryProperty
DateCell
and Cell
for more information on cell factories.
Example:
final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() {
public DateCell call(final DatePicker datePicker) {
return new DateCell() {
@Override public void updateItem(LocalDate item, boolean empty) {
super.updateItem(item, empty);
if (MonthDay.from(item).equals(MonthDay.of(9, 25))) {
setTooltip(new Tooltip("Happy Birthday!"));
setStyle("-fx-background-color: #ff4444;");
}
if (item.equals(LocalDate.now().plusDays(1))) {
// Tomorrow is too soon.
setDisable(true);
}
}
};
}
};
datePicker.setDayCellFactory(dayCellFactory);
getDayCellFactory()
,
setDayCellFactory(Callback)
public final ObjectProperty<java.time.chrono.Chronology> chronologyProperty
The default value is returned from a call to
Chronology.ofLocale(Locale.getDefault(Locale.Category.FORMAT))
.
The default is usually <code>IsoChronology</code> unless
provided explicitly in the <code>Locale</code> by use of a
Locale calendar extension.
Setting the value to null
will restore the default
chronology.
getChronology()
,
setChronology(Chronology)
public final BooleanProperty showWeekNumbersProperty
The default value is false unless otherwise defined in a resource bundle for the current locale.
This property may be toggled by the end user by using a context menu in the DatePicker popup, so it is recommended that applications save and restore the value between sessions.
isShowWeekNumbers()
,
setShowWeekNumbers(boolean)
public final ObjectProperty<StringConverter<java.time.LocalDate>> converterProperty
If not set by the application, the DatePicker skin class will
set a converter based on a java.time.DateTimeFormatter
for the current <code>Locale</code> and
chronology
. This formatter is
then used to parse and display the current date value.
Setting the value to null
will restore the default
converter.
Example using an explicit formatter:
datePicker.setConverter(new StringConverter<LocalDate>() {
String pattern = "yyyy-MM-dd";
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(pattern);
{
datePicker.setPromptText(pattern.toLowerCase());
}
@Override public String toString(LocalDate date) {
if (date != null) {
return dateFormatter.format(date);
} else {
return "";
}
}
@Override public LocalDate fromString(String string) {
if (string != null && !string.isEmpty()) {
return LocalDate.parse(string, dateFormatter);
} else {
return null;
}
}
});
Example that wraps the default formatter and catches parse exceptions:
final StringConverter<LocalDate> defaultConverter = datePicker.getConverter();
datePicker.setConverter(new StringConverter<LocalDate>() {
@Override public String toString(LocalDate value) {
return defaultConverter.toString(value);
}
@Override public LocalDate fromString(String text) {
try {
return defaultConverter.fromString(text);
} catch (DateTimeParseException ex) {
System.err.println("HelloDatePicker: "+ex.getMessage());
throw ex;
}
}
});
getConverter()
,
setConverter(StringConverter)
public final ReadOnlyObjectProperty<TextField> editorProperty
getEditor()
public DatePicker()
null
date value set.public DatePicker(java.time.LocalDate localDate)
value
to the given date.localDate
- to be set as the currently selected date in the DatePicker. Can be null.public final void setDayCellFactory(Callback<DatePicker,DateCell> value)
DateCell
and Cell
for more information on cell factories.
Example:
final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() {
public DateCell call(final DatePicker datePicker) {
return new DateCell() {
@Override public void updateItem(LocalDate item, boolean empty) {
super.updateItem(item, empty);
if (MonthDay.from(item).equals(MonthDay.of(9, 25))) {
setTooltip(new Tooltip("Happy Birthday!"));
setStyle("-fx-background-color: #ff4444;");
}
if (item.equals(LocalDate.now().plusDays(1))) {
// Tomorrow is too soon.
setDisable(true);
}
}
};
}
};
datePicker.setDayCellFactory(dayCellFactory);
public final Callback<DatePicker,DateCell> getDayCellFactory()
DateCell
and Cell
for more information on cell factories.
Example:
final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() {
public DateCell call(final DatePicker datePicker) {
return new DateCell() {
@Override public void updateItem(LocalDate item, boolean empty) {
super.updateItem(item, empty);
if (MonthDay.from(item).equals(MonthDay.of(9, 25))) {
setTooltip(new Tooltip("Happy Birthday!"));
setStyle("-fx-background-color: #ff4444;");
}
if (item.equals(LocalDate.now().plusDays(1))) {
// Tomorrow is too soon.
setDisable(true);
}
}
};
}
};
datePicker.setDayCellFactory(dayCellFactory);
public final ObjectProperty<Callback<DatePicker,DateCell>> dayCellFactoryProperty()
DateCell
and Cell
for more information on cell factories.
Example:
final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() {
public DateCell call(final DatePicker datePicker) {
return new DateCell() {
@Override public void updateItem(LocalDate item, boolean empty) {
super.updateItem(item, empty);
if (MonthDay.from(item).equals(MonthDay.of(9, 25))) {
setTooltip(new Tooltip("Happy Birthday!"));
setStyle("-fx-background-color: #ff4444;");
}
if (item.equals(LocalDate.now().plusDays(1))) {
// Tomorrow is too soon.
setDisable(true);
}
}
};
}
};
datePicker.setDayCellFactory(dayCellFactory);
getDayCellFactory()
,
setDayCellFactory(Callback)
public final ObjectProperty<java.time.chrono.Chronology> chronologyProperty()
The default value is returned from a call to
Chronology.ofLocale(Locale.getDefault(Locale.Category.FORMAT))
.
The default is usually <code>IsoChronology</code> unless
provided explicitly in the <code>Locale</code> by use of a
Locale calendar extension.
Setting the value to null
will restore the default
chronology.
getChronology()
,
setChronology(Chronology)
public final java.time.chrono.Chronology getChronology()
The default value is returned from a call to
Chronology.ofLocale(Locale.getDefault(Locale.Category.FORMAT))
.
The default is usually <code>IsoChronology</code> unless
provided explicitly in the <code>Locale</code> by use of a
Locale calendar extension.
Setting the value to null
will restore the default
chronology.
public final void setChronology(java.time.chrono.Chronology value)
The default value is returned from a call to
Chronology.ofLocale(Locale.getDefault(Locale.Category.FORMAT))
.
The default is usually <code>IsoChronology</code> unless
provided explicitly in the <code>Locale</code> by use of a
Locale calendar extension.
Setting the value to null
will restore the default
chronology.
public final BooleanProperty showWeekNumbersProperty()
The default value is false unless otherwise defined in a resource bundle for the current locale.
This property may be toggled by the end user by using a context menu in the DatePicker popup, so it is recommended that applications save and restore the value between sessions.
isShowWeekNumbers()
,
setShowWeekNumbers(boolean)
public final void setShowWeekNumbers(boolean value)
The default value is false unless otherwise defined in a resource bundle for the current locale.
This property may be toggled by the end user by using a context menu in the DatePicker popup, so it is recommended that applications save and restore the value between sessions.
public final boolean isShowWeekNumbers()
The default value is false unless otherwise defined in a resource bundle for the current locale.
This property may be toggled by the end user by using a context menu in the DatePicker popup, so it is recommended that applications save and restore the value between sessions.
public final ObjectProperty<StringConverter<java.time.LocalDate>> converterProperty()
If not set by the application, the DatePicker skin class will
set a converter based on a java.time.DateTimeFormatter
for the current <code>Locale</code> and
chronology
. This formatter is
then used to parse and display the current date value.
Setting the value to null
will restore the default
converter.
Example using an explicit formatter:
datePicker.setConverter(new StringConverter<LocalDate>() {
String pattern = "yyyy-MM-dd";
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(pattern);
{
datePicker.setPromptText(pattern.toLowerCase());
}
@Override public String toString(LocalDate date) {
if (date != null) {
return dateFormatter.format(date);
} else {
return "";
}
}
@Override public LocalDate fromString(String string) {
if (string != null && !string.isEmpty()) {
return LocalDate.parse(string, dateFormatter);
} else {
return null;
}
}
});
Example that wraps the default formatter and catches parse exceptions:
final StringConverter<LocalDate> defaultConverter = datePicker.getConverter();
datePicker.setConverter(new StringConverter<LocalDate>() {
@Override public String toString(LocalDate value) {
return defaultConverter.toString(value);
}
@Override public LocalDate fromString(String text) {
try {
return defaultConverter.fromString(text);
} catch (DateTimeParseException ex) {
System.err.println("HelloDatePicker: "+ex.getMessage());
throw ex;
}
}
});
getConverter()
,
setConverter(StringConverter)
public final void setConverter(StringConverter<java.time.LocalDate> value)
If not set by the application, the DatePicker skin class will
set a converter based on a java.time.DateTimeFormatter
for the current <code>Locale</code> and
chronology
. This formatter is
then used to parse and display the current date value.
Setting the value to null
will restore the default
converter.
Example using an explicit formatter:
datePicker.setConverter(new StringConverter<LocalDate>() {
String pattern = "yyyy-MM-dd";
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(pattern);
{
datePicker.setPromptText(pattern.toLowerCase());
}
@Override public String toString(LocalDate date) {
if (date != null) {
return dateFormatter.format(date);
} else {
return "";
}
}
@Override public LocalDate fromString(String string) {
if (string != null && !string.isEmpty()) {
return LocalDate.parse(string, dateFormatter);
} else {
return null;
}
}
});
Example that wraps the default formatter and catches parse exceptions:
final StringConverter<LocalDate> defaultConverter = datePicker.getConverter();
datePicker.setConverter(new StringConverter<LocalDate>() {
@Override public String toString(LocalDate value) {
return defaultConverter.toString(value);
}
@Override public LocalDate fromString(String text) {
try {
return defaultConverter.fromString(text);
} catch (DateTimeParseException ex) {
System.err.println("HelloDatePicker: "+ex.getMessage());
throw ex;
}
}
});
public final StringConverter<java.time.LocalDate> getConverter()
If not set by the application, the DatePicker skin class will
set a converter based on a java.time.DateTimeFormatter
for the current <code>Locale</code> and
chronology
. This formatter is
then used to parse and display the current date value.
Setting the value to null
will restore the default
converter.
Example using an explicit formatter:
datePicker.setConverter(new StringConverter<LocalDate>() {
String pattern = "yyyy-MM-dd";
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(pattern);
{
datePicker.setPromptText(pattern.toLowerCase());
}
@Override public String toString(LocalDate date) {
if (date != null) {
return dateFormatter.format(date);
} else {
return "";
}
}
@Override public LocalDate fromString(String string) {
if (string != null && !string.isEmpty()) {
return LocalDate.parse(string, dateFormatter);
} else {
return null;
}
}
});
Example that wraps the default formatter and catches parse exceptions:
final StringConverter<LocalDate> defaultConverter = datePicker.getConverter();
datePicker.setConverter(new StringConverter<LocalDate>() {
@Override public String toString(LocalDate value) {
return defaultConverter.toString(value);
}
@Override public LocalDate fromString(String text) {
try {
return defaultConverter.fromString(text);
} catch (DateTimeParseException ex) {
System.err.println("HelloDatePicker: "+ex.getMessage());
throw ex;
}
}
});
public final TextField getEditor()
public final ReadOnlyObjectProperty<TextField> editorProperty()
getEditor()
protected Skin<?> createDefaultSkin()
-fx-skin
or set explicitly in a sub-class with setSkin(...)
.createDefaultSkin
in class Control
public static java.util.List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
public java.util.List<CssMetaData<? extends Styleable,?>> getControlCssMetaData()
getControlCssMetaData
in class Control
Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. Use is subject to