Class LocalTimeStringConverter
- javafx.util.StringConverter<LocalTime>
-
- javafx.util.converter.LocalTimeStringConverter
public class LocalTimeStringConverter extends StringConverter<LocalTime>
StringConverter implementation for LocalTime values.
Since:
JavaFX 8u40
-
Constructor Summary
Constructors Constructor and Description LocalTimeStringConverter()Create aStringConverterforLocalTimevalues, using a default formatter and parser withFormatStyle.SHORT, and the user'sLocale.LocalTimeStringConverter(DateTimeFormatter formatter, DateTimeFormatter parser)LocalTimeStringConverter(FormatStyle timeStyle)Create aStringConverterforLocalTimevalues, using a default formatter and parser with the specifiedFormatStyleand based on the user'sLocale.LocalTimeStringConverter(FormatStyle timeStyle, Locale locale)Create a StringConverter forLocalTimevalues, using a default formatter and parser with the specifiedFormatStyleandLocale.
-
Method Summary
All MethodsInstance MethodsConcrete Methods Modifier and Type Method and Description LocalTimefromString(String value)Converts the string provided into an object defined by the specific converter.StringtoString(LocalTime value)Converts the object provided into its string form.
-
Constructor Detail
-
LocalTimeStringConverter
public LocalTimeStringConverter()
Create aStringConverterforLocalTimevalues, using a default formatter and parser withFormatStyle.SHORT, and the user'sLocale.
-
LocalTimeStringConverter
public LocalTimeStringConverter(FormatStyle timeStyle)
Create aStringConverterforLocalTimevalues, using a default formatter and parser with the specifiedFormatStyleand based on the user'sLocale.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 forLocalTimevalues, using a default formatter and parser with the specifiedFormatStyleandLocale.Parameters:
timeStyle- TheFormatStylethat will be used by the default formatter and parser. If null thenFormatStyle.SHORTwill be used.
-
LocalTimeStringConverter
public LocalTimeStringConverter(DateTimeFormatter formatter, DateTimeFormatter parser)Create a StringConverter forLocalTimevalues using the supplied formatter and parser, which are responsible for choosing the desiredLocale.For example, a fixed pattern can be used for converting both ways:
String pattern = "HH:mm:ss"; DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); StringConverter 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.
-
-
Method Detail
-
fromString
public LocalTime fromString(String value)
Converts the string provided into an object defined by the specific converter. Format of the string and type of the resulting object is defined by the specific converter.Specified by:
fromStringin classStringConverter<LocalTime>Returns:
an object representation of the string passed in.
-
toString
public String toString(LocalTime value)
Converts the object provided into its string form. Format of the returned string is defined by the specific converter.Specified by:
toStringin classStringConverter<LocalTime>Returns:
a string representation of the object passed in.
-
© 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.