Package javax.swing.JFormattedTextField

Examples of javax.swing.JFormattedTextField.AbstractFormatterFactory


     *
     * @return array of formats guaranteed to be not null, but might be empty.
     */
    public DateFormat[] getFormats() {
        // Dig this out from the factory, if possible, otherwise return null.
        AbstractFormatterFactory factory = _dateField.getFormatterFactory();
        if (factory != null) {
            AbstractFormatter formatter = factory.getFormatter(_dateField);
            if (formatter instanceof DatePickerFormatter) {
                return ((DatePickerFormatter) formatter).getFormats();
            }
        }
        return EMPTY_DATE_FORMATS;
View Full Code Here


    public void bind(JComponent control, ValueModel valueModel)
    {   
        DataField df = (DataField)control;
        if (valueModel instanceof TypeAwareValueModel) {
            TypeAwareValueModel value = (TypeAwareValueModel)valueModel;
            AbstractFormatterFactory aff = df.getFormatterFactory();
            if (aff != null && aff instanceof DataFieldFormatterFactory) {
                ((DataFieldFormatterFactory)aff).setMappedType(value.getValueType());
            }
        }
        Bindings.bind(df, valueModel);
View Full Code Here

    public void bind(JComponent control, ValueModel valueModel)
    {   
        DataField df = (DataField)control;
        if (valueModel instanceof TypeAwareValueModel) {
            TypeAwareValueModel value = (TypeAwareValueModel)valueModel;
            AbstractFormatterFactory aff = df.getFormatterFactory();
            if (aff != null && aff instanceof DataFieldFormatterFactory) {
                ((DataFieldFormatterFactory)aff).setMappedType(value.getValueType());
            }
        }
        Bindings.bind(df, valueModel);
View Full Code Here

    public void bind(JComponent control, ValueModel valueModel)
    {   
        DataField df = (DataField)control;
        if (valueModel instanceof TypeAwareValueModel) {
            TypeAwareValueModel value = (TypeAwareValueModel)valueModel;
            AbstractFormatterFactory aff = df.getFormatterFactory();
            if (aff != null && aff instanceof DataFieldFormatterFactory) {
                ((DataFieldFormatterFactory)aff).setMappedType(value.getValueType());
            }
        }
        Bindings.bind(df, valueModel);
View Full Code Here

     *   used defaults as defined in the datepicker properties
     */
    private DateFormat[] getCustomFormats(JFormattedTextField editor) {
        DateFormat[] formats = null;
        if (editor != null) {
            AbstractFormatterFactory factory = editor.getFormatterFactory();
            if (factory != null) {
                AbstractFormatter formatter = factory.getFormatter(editor);
                // fix for #1144: classCastException for custom formatters
                // PENDING JW: revisit for #1138
                if ((formatter instanceof DatePickerFormatter) && !(formatter instanceof UIResource)) {
//                if (!(formatter instanceof DatePickerFormatterUIResource))  {
                    formats = ((DatePickerFormatter) formatter).getFormats();
View Full Code Here

    public JAmountField() {
        initComponents();
       
        final JAmountField _this = this;
       
        this.amountJFormattedTextField.setFormatterFactory(new AbstractFormatterFactory() {
            @Override
            public AbstractFormatter getFormatter(JFormattedTextField field) {
                NumberFormat format = DecimalFormat.getInstance();
                format.setMinimumFractionDigits(2);
                format.setMaximumFractionDigits(2);
View Full Code Here

TOP

Related Classes of javax.swing.JFormattedTextField.AbstractFormatterFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.