/* * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javafx.util.converter; import java.time.LocalTime; import java.time.format.DateTimeFormatter; import java.time.format.FormatStyle; import java.util.Locale; import javafx.util.StringConverter; import javafx.util.converter.LocalDateTimeStringConverter.LdtConverter; /** *
{@link StringConverter} implementation for {@link LocalTime} values.
* * @see LocalDateStringConverter * @see LocalDateTimeStringConverter * @since JavaFX 8u40 */ public class LocalTimeStringConverter extends StringConverterFor example, a fixed pattern can be used for converting both ways:
** * @param formatter An instance of {@link DateTimeFormatter} which * will be used for formatting by the toString() method. If null * then a default formatter will be used. * @param parser An instance of {@link DateTimeFormatter} which * 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. */ public LocalTimeStringConverter(DateTimeFormatter formatter, DateTimeFormatter parser) { ldtConverter = new LdtConverter* String pattern = "HH:mm:ss"; * DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); * StringConverterconverter = * DateTimeStringConverter.getLocalTimeConverter(formatter, null); *