Class LocalTimeStringConverter
public class LocalTimeStringConverter
extends StringConverter<LocalTime> StringConverter implementation for LocalTime values.
- Since:
- JavaFX 8u40
- See Also:
-
LocalDateStringConverter,LocalDateTimeStringConverter
Constructor Summary
| Constructor | Description |
|---|---|
LocalTimeStringConverter() | Create a StringConverter for LocalTime values, using a default formatter and parser with FormatStyle.SHORT, and the user's Locale. |
LocalTimeStringConverter(DateTimeFormatter formatter,
DateTimeFormatter parser) | |
LocalTimeStringConverter(FormatStyle timeStyle) | Create a StringConverter for LocalTime values, using a default formatter and parser with the specified FormatStyle and based on the user's Locale. |
LocalTimeStringConverter(FormatStyle timeStyle,
Locale locale) | Create a StringConverter for LocalTime values, using a default formatter and parser with the specified FormatStyle and Locale. |
Method Summary
Methods declared in class javafx.util.StringConverter
fromString, toString
Constructor Details
LocalTimeStringConverter
public LocalTimeStringConverter()
Create a
StringConverter for LocalTime values, using a default formatter and parser with FormatStyle.SHORT, and the user's Locale.LocalTimeStringConverter
public LocalTimeStringConverter(FormatStyle timeStyle)
Create a
StringConverter for LocalTime values, using a default formatter and parser with the specified FormatStyle and based on the user's Locale.- Parameters:
-
timeStyle- TheFormatStylethat will be used by the default formatter and parser. If null thenFormatStyle.SHORTwill be used.
LocalTimeStringConverter
public LocalTimeStringConverter(FormatStyle timeStyle, Locale locale)
Create a StringConverter for
LocalTime values, using a default formatter and parser with the specified FormatStyle and Locale.- Parameters:
-
timeStyle- TheFormatStylethat will be used by the default formatter and parser. If null thenFormatStyle.SHORTwill be used. -
locale- TheLocalethat will be used by the default formatter and parser. If null thenLocale.getDefault(Locale.Category.FORMAT)will be used.
LocalTimeStringConverter
public LocalTimeStringConverter(DateTimeFormatter formatter, DateTimeFormatter parser)
Create a StringConverter for
LocalTime values using the supplied formatter and parser, which are responsible for choosing the desired Locale. For example, a fixed pattern can be used for converting both ways:
String pattern = "HH:mm:ss";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
StringConverter<LocalTime> converter =
DateTimeStringConverter.getLocalTimeConverter(formatter, null);
- Parameters:
-
formatter- An instance ofDateTimeFormatterwhich will be used for formatting by the toString() method. If null then a default formatter will be used. -
parser- An instance ofDateTimeFormatterwhich will be used for parsing by the fromString() method. This can be identical to formatter. If null, then formatter will be used, and if that is also null, then a default parser will be used.
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.