Top Description Inners Fields Constructors Methods
com.dlsc.gemsfx

public Class TimePicker

extends CustomComboBox<LocalTime>
Class Inheritance
Imports
com.dlsc.gemsfx.skins.TimePickerSkin, javafx.beans.property.BooleanProperty, .IntegerProperty, .ObjectProperty, .ReadOnlyBooleanProperty, .ReadOnlyBooleanWrapper, .SimpleBooleanProperty, .SimpleIntegerProperty, .SimpleObjectProperty, javafx.collections.MapChangeListener, javafx.scene.Node, javafx.scene.control.Label, .Skin, javafx.scene.input.KeyCode, javafx.scene.layout.Region, java.time.LocalTime, java.util.Objects, java.util.function.Consumer

A control for letting the user enter a time of day (see LocalTime). The control can be configured to only enter a time within a given time range. It can also be configured to show hours and minutes, or hours and minutes and seconds, or hours and minutes and seconds and milliseconds (see formatProperty())

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
TimePicker.ClockType

The time picker control supports 12 and 24 hour times.

public static enum
TimePicker.Format

An enum for supported time units.

Field Summary

Modifier and TypeField and Description
private final ReadOnlyBooleanWrapper
private boolean
private final ObjectProperty<TimePicker.ClockType>
private final ObjectProperty<LocalTime>
private final ObjectProperty<TimePicker.Format>
private final ObjectProperty<Node>
private final ObjectProperty<LocalTime>
private final BooleanProperty
private final ObjectProperty<Node>
private final ObjectProperty<Consumer<TimePicker>>
private final BooleanProperty
private final ObjectProperty<Node>
private final BooleanProperty
private final IntegerProperty
private final ObjectProperty<LocalTime>

Constructor Summary

AccessConstructor and Description
public
TimePicker()

Constructs a new time picker.

Method Summary

Modifier and TypeMethod and Description
public final void
adjust()

Adjusts the time picker's time based on the earliest and latest time allowed and also based on the step rate currently in effect.

public final ReadOnlyBooleanProperty
private boolean
private boolean
public final ObjectProperty<TimePicker.ClockType>

Returns:

the type of the clock
clockTypeProperty
()

The clock type determines whether the control will display 24 or 12 hours.

protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public final ObjectProperty<LocalTime>

Returns:

the earliest time allowed
earliestTimeProperty
()

The earliest time that the user can enter via the time picker.

public final ObjectProperty<TimePicker.Format>

Returns:

the time unit
formatProperty
()

The format used by the picker, e.g. "hours and minutes", or "hours, minutes, and seconds".

private LocalTime
public final TimePicker.ClockType
public final LocalTime
public final TimePicker.Format
public final Node
public final LocalTime
public final Node
public final Consumer<TimePicker>
public final Node
public final Node
getSeparator()
Deprecated

public final int
public final LocalTime
public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final ObjectProperty<Node>

Returns:

a node used as a hoursSeparator
hoursSeparatorProperty
()

The node that will be placed between the hours and the minutes field.

public final boolean
public final boolean
public final boolean
public final boolean
public final ObjectProperty<LocalTime>

Returns:

the latest time allowed
latestTimeProperty
()

The latest time that the user can enter via the time picker.

public final BooleanProperty

Returns:

true if rollover is desired
linkingFieldsProperty
()

A property used to control whether the fields should automatically increase or decrease the previous field when they reach their upper or lower limit.

public final ObjectProperty<Node>

Returns:

a node used as a hoursSeparator
minutesSeparatorProperty
()

The node that will be placed between the minutes and the seconds field.

public final ObjectProperty<Consumer<TimePicker>>

Returns:

the "on show popup" consumer
onShowPopupProperty
()

This consumer will be invoked to bring up a control for entering the time without using the keyboard.

public final BooleanProperty

Returns:

true if the fields should rollover
rolloverProperty
()

A flag used to signal whether the time fields should start at the beginning of its value range when it reaches the end of it.

public final ObjectProperty<Node>

Returns:

a node used as a hoursSeparator
secondsSeparatorProperty
()

The node that will be placed between the seconds and the milliseconds field.

public final ObjectProperty<Node>

Returns:

a node used as a hoursSeparator
separatorProperty
()
Deprecated we now have more than just one separator, hence use hoursSeparatorProperty() etc...

The node that will be placed between the hours and the minutes field.

public final void
public final void
setEarliestTime(LocalTime earliestTime)

public final void
public final void
public final void
public final void
setLinkingFields(boolean linkingFields)

public final void
public final void
public final void
setRollover(boolean rollover)

public final void
public final void
setSeparator(Node separator)
Deprecated

public final void
setShowPopupTriggerButton(boolean showPopupTriggerButton)

public final void
setStepRateInMinutes(int stepRateInMinutes)

public final void
public final BooleanProperty

Returns:

true if the control will show a button for showing the popup
showPopupTriggerButtonProperty
()

Determines if the control will show a button for showing or hiding the popup.

public final IntegerProperty

Returns:

the step rate in minutes
stepRateInMinutesProperty
()

Stores the "step rate" used by the control when the user increases or decreases the minutes field.

public final ObjectProperty<LocalTime>

Returns:

the chosen time
timeProperty
()

Stores the current time displayed by the control.

Inherited from com.dlsc.gemsfx.CustomComboBox:
buttonDisplayPropertygetButtonDisplaygetClassCssMetaDatagetControlCssMetaDatasetButtonDisplay

Field Detail

adjustedback to summary
private final ReadOnlyBooleanWrapper adjusted
adjustmentInProgressback to summary
private boolean adjustmentInProgress
clockTypeback to summary
private final ObjectProperty<TimePicker.ClockType> clockType
earliestTimeback to summary
private final ObjectProperty<LocalTime> earliestTime
formatback to summary
private final ObjectProperty<TimePicker.Format> format
hoursSeparatorback to summary
private final ObjectProperty<Node> hoursSeparator
latestTimeback to summary
private final ObjectProperty<LocalTime> latestTime
linkingFieldsback to summary
private final BooleanProperty linkingFields
minutesSeparatorback to summary
private final ObjectProperty<Node> minutesSeparator
onShowPopupback to summary
private final ObjectProperty<Consumer<TimePicker>> onShowPopup
rolloverback to summary
private final BooleanProperty rollover
secondsSeparatorback to summary
private final ObjectProperty<Node> secondsSeparator
showPopupTriggerButtonback to summary
private final BooleanProperty showPopupTriggerButton
stepRateInMinutesback to summary
private final IntegerProperty stepRateInMinutes
timeback to summary
private final ObjectProperty<LocalTime> time

Constructor Detail

TimePickerback to summary
public TimePicker()

Constructs a new time picker.

Method Detail

adjustback to summary
public final void adjust()

Adjusts the time picker's time based on the earliest and latest time allowed and also based on the step rate currently in effect.

adjustedPropertyback to summary
public final ReadOnlyBooleanProperty adjustedProperty()
adjustViaStepRateback to summary
private boolean adjustViaStepRate()
adjustViaTimeBoundsback to summary
private boolean adjustViaTimeBounds()
clockTypePropertyback to summary
public final ObjectProperty<TimePicker.ClockType> clockTypeProperty()

The clock type determines whether the control will display 24 or 12 hours. If the control shows 12 hours then an additional field for choosing between the "am" or "pm" meridian will be added.

Returns:ObjectProperty<TimePicker.ClockType>

the type of the clock

createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Annotations
@Override
earliestTimePropertyback to summary
public final ObjectProperty<LocalTime> earliestTimeProperty()

The earliest time that the user can enter via the time picker.

Returns:ObjectProperty<LocalTime>

the earliest time allowed

formatPropertyback to summary
public final ObjectProperty<TimePicker.Format> formatProperty()

The format used by the picker, e.g. "hours and minutes", or "hours, minutes, and seconds".

Returns:ObjectProperty<TimePicker.Format>

the time unit

getAdjustedTimeback to summary
private LocalTime getAdjustedTime(LocalTime time)
getClockTypeback to summary
public final TimePicker.ClockType getClockType()
getEarliestTimeback to summary
public final LocalTime getEarliestTime()
getFormatback to summary
public final TimePicker.Format getFormat()
getHoursSeparatorback to summary
public final Node getHoursSeparator()
getLatestTimeback to summary
public final LocalTime getLatestTime()
getMinutesSeparatorback to summary
public final Node getMinutesSeparator()
getOnShowPopupback to summary
public final Consumer<TimePicker> getOnShowPopup()
getSecondsSeparatorback to summary
public final Node getSecondsSeparator()
getSeparatorback to summary
public final Node getSeparator()

Deprecated

Annotations
@Deprecated
getStepRateInMinutesback to summary
public final int getStepRateInMinutes()
getTimeback to summary
public final LocalTime getTime()
getUserAgentStylesheetback to summary
public String getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

Doc from javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls.

The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.

Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.



package com.example.javafx.app;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MyApp extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
Annotations
@Override
hoursSeparatorPropertyback to summary
public final ObjectProperty<Node> hoursSeparatorProperty()

The node that will be placed between the hours and the minutes field. The default separator is a label with text ":".

Returns:ObjectProperty<Node>

a node used as a hoursSeparator

isAdjustedback to summary
public final boolean isAdjusted()
isLinkingFieldsback to summary
public final boolean isLinkingFields()
isRolloverback to summary
public final boolean isRollover()
isShowPopupTriggerButtonback to summary
public final boolean isShowPopupTriggerButton()
latestTimePropertyback to summary
public final ObjectProperty<LocalTime> latestTimeProperty()

The latest time that the user can enter via the time picker.

Returns:ObjectProperty<LocalTime>

the latest time allowed

linkingFieldsPropertyback to summary
public final BooleanProperty linkingFieldsProperty()

A property used to control whether the fields should automatically increase or decrease the previous field when they reach their upper or lower limit.

Returns:BooleanProperty

true if rollover is desired

minutesSeparatorPropertyback to summary
public final ObjectProperty<Node> minutesSeparatorProperty()

The node that will be placed between the minutes and the seconds field. The default separator is a label with text ":".

Returns:ObjectProperty<Node>

a node used as a hoursSeparator

onShowPopupPropertyback to summary
public final ObjectProperty<Consumer<TimePicker>> onShowPopupProperty()

This consumer will be invoked to bring up a control for entering the time without using the keyboard. The default implementation shows a popup.

Returns:ObjectProperty<Consumer<TimePicker>>

the "on show popup" consumer

rolloverPropertyback to summary
public final BooleanProperty rolloverProperty()

A flag used to signal whether the time fields should start at the beginning of its value range when it reaches the end of it. E.g. incrementing hour 23 would result in hour 0 when the user tries to increase it by one.

Returns:BooleanProperty

true if the fields should rollover

secondsSeparatorPropertyback to summary
public final ObjectProperty<Node> secondsSeparatorProperty()

The node that will be placed between the seconds and the milliseconds field. The default separator is a label with text ".".

Returns:ObjectProperty<Node>

a node used as a hoursSeparator

separatorPropertyback to summary
public final ObjectProperty<Node> separatorProperty()

Deprecated

we now have more than just one separator, hence use hoursSeparatorProperty() etc...

The node that will be placed between the hours and the minutes field. The default separator is a label with text ":".

Returns:ObjectProperty<Node>

a node used as a hoursSeparator

Annotations
@Deprecated
setClockTypeback to summary
public final void setClockType(TimePicker.ClockType clockType)
setEarliestTimeback to summary
public final void setEarliestTime(LocalTime earliestTime)
setFormatback to summary
public final void setFormat(TimePicker.Format timeUnit)
setHoursSeparatorback to summary
public final void setHoursSeparator(Node separator)
setLatestTimeback to summary
public final void setLatestTime(LocalTime latestTime)
setLinkingFieldsback to summary
public final void setLinkingFields(boolean linkingFields)
setMinutesSeparatorback to summary
public final void setMinutesSeparator(Node separator)
setOnShowPopupback to summary
public final void setOnShowPopup(Consumer<TimePicker> onShowPopup)
setRolloverback to summary
public final void setRollover(boolean rollover)
setSecondsSeparatorback to summary
public final void setSecondsSeparator(Node separator)
setSeparatorback to summary
public final void setSeparator(Node separator)

Deprecated

Annotations
@Deprecated
setShowPopupTriggerButtonback to summary
public final void setShowPopupTriggerButton(boolean showPopupTriggerButton)
setStepRateInMinutesback to summary
public final void setStepRateInMinutes(int stepRateInMinutes)
setTimeback to summary
public final void setTime(LocalTime time)
showPopupTriggerButtonPropertyback to summary
public final BooleanProperty showPopupTriggerButtonProperty()

Determines if the control will show a button for showing or hiding the popup.

Returns:BooleanProperty

true if the control will show a button for showing the popup

stepRateInMinutesPropertyback to summary
public final IntegerProperty stepRateInMinutesProperty()

Stores the "step rate" used by the control when the user increases or decreases the minutes field. The step rate can be used to (for example) make the minutes increase or decrease by 15 minutes every time the user presses the arrow up or down keys.

Returns:IntegerProperty

the step rate in minutes

timePropertyback to summary
public final ObjectProperty<LocalTime> timeProperty()

Stores the current time displayed by the control.

Returns:ObjectProperty<LocalTime>

the chosen time

com.dlsc.gemsfx back to summary

public final Enum TimePicker.ClockType

extends Enum<TimePicker.ClockType>
Class Inheritance

The time picker control supports 12 and 24 hour times. 12 hour times require an additional field for the user to enter am / pm.

Field Summary

Modifier and TypeField and Description
public static final TimePicker.ClockType
public static final TimePicker.ClockType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TimePicker.ClockType
public static TimePicker.ClockType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

TWELVE_HOUR_CLOCKback to summary
public static final TimePicker.ClockType TWELVE_HOUR_CLOCK
TWENTY_FOUR_HOUR_CLOCKback to summary
public static final TimePicker.ClockType TWENTY_FOUR_HOUR_CLOCK

Constructor Detail

ClockTypeback to summary
private ClockType()

Method Detail

valueOfback to summary
public static TimePicker.ClockType valueOf(String name)
valuesback to summary
public static TimePicker.ClockType[] values()
com.dlsc.gemsfx back to summary

public final Enum TimePicker.Format

extends Enum<TimePicker.Format>
Class Inheritance

An enum for supported time units. See formatProperty()

Field Summary

Modifier and TypeField and Description
public static final TimePicker.Format
public static final TimePicker.Format
public static final TimePicker.Format

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TimePicker.Format
public static TimePicker.Format[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

HOURS_MINUTESback to summary
public static final TimePicker.Format HOURS_MINUTES
HOURS_MINUTES_SECONDSback to summary
public static final TimePicker.Format HOURS_MINUTES_SECONDS
HOURS_MINUTES_SECONDS_MILLISback to summary
public static final TimePicker.Format HOURS_MINUTES_SECONDS_MILLIS

Constructor Detail

Formatback to summary
private Format()

Method Detail

valueOfback to summary
public static TimePicker.Format valueOf(String name)
valuesback to summary
public static TimePicker.Format[] values()