微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.swing.JFormattedTextField.AbstractFormatter的实例源码

项目:javify    文件DefaultFormatterFactory.java   
/**
 * Returns the appropriate formatter based on the state of
 * <code>tf</code>. If <code>tf<code> is null we return null,otherwise
 * we return one of the following:
 * 1. Returns <code>nullFormatter</code> if <code>tf.getValue()</code> is
 * null and <code>nullFormatter</code> is not.
 * 2. Returns <code>editFormatter</code> if <code>tf.hasFocus()</code> is
 * true and <code>editFormatter</code> is not null.
 * 3. Returns <code>displayFormatter</code> if <code>tf.hasFocus()</code> is
 * false and <code>displayFormatter</code> is not null.
 * 4. Otherwise returns <code>defaultFormatter</code>.
 */
public AbstractFormatter getFormatter(jformattedtextfield tf)
{
  if (tf == null)
    return null;

  if (tf.getValue() == null && nullFormatter != null)
    return nullFormatter;

  if (tf.hasFocus() && editFormatter != null)
    return editFormatter;

  if (!tf.hasFocus() && displayFormatter != null)
    return displayFormatter;

  return defaultFormatter;
}
项目:jvm-stm    文件DefaultFormatterFactory.java   
/**
 * Returns the appropriate formatter based on the state of 
 * <code>tf</code>. If <code>tf<code> is null we return null,otherwise
 * we return one of the following:
 * 1. Returns <code>nullFormatter</code> if <code>tf.getValue()</code> is 
 * null and <code>nullFormatter</code> is not.  
 * 2. Returns <code>editFormatter</code> if <code>tf.hasFocus()</code> is
 * true and <code>editFormatter</code> is not null.
 * 3. Returns <code>displayFormatter</code> if <code>tf.hasFocus()</code> is
 * false and <code>displayFormatter</code> is not null.
 * 4. Otherwise returns <code>defaultFormatter</code>.
 */
public AbstractFormatter getFormatter(jformattedtextfield tf)
{
  if (tf == null)
    return null;

  if (tf.getValue() == null && nullFormatter != null)
    return nullFormatter;

  if (tf.hasFocus() && editFormatter != null)
    return editFormatter;

  if (!tf.hasFocus() && displayFormatter != null)
    return displayFormatter;

  return defaultFormatter;
}
项目:swingx    文件BasicDatePickerUI.java   
/**
     * Checks and returns custom formats on the editor,if any.
     * 
     * @param editor the editor to check
     * @return the custom formats uses in the editor or null if it had
     *   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();
                }
            }

        }
        return formats;
    }
项目:Metasfresh    文件SwingTerminalTextField.java   
@Override
public void setCommitOnValidEdit(final boolean commit)
{
    if (textComponent instanceof jformattedtextfield)
    {
        final jformattedtextfield formattedTextField = (jformattedtextfield)textComponent;
        final AbstractFormatter formatter = formattedTextField.getFormatter();
        if (formatter instanceof DefaultFormatter)
        {
            final DefaultFormatter defaultFormatter = (DefaultFormatter)formatter;
            defaultFormatter.setCommitsOnValidEdit(commit);
            return;
        }
    }
    else if (textComponent instanceof JTextArea)
    {
        // ignore it for Now
    }
    else
    {
        throw new UnsupportedOperationException("setCommitOnValidValue not supported for " + this);
    }
}
项目:frinika    文件TickSpinner.java   
private void init() {
    jformattedtextfield ftf = (jformattedtextfield)((JSpinner.DefaultEditor)this.getEditor()).getTextField(); // ! depends on swing implementation to actually use FormattedTextField
    ftf.setColumns(((TickSpinnerModel)getModel()).format.textFieldSize);
    ftf.setFormatterFactory(new jformattedtextfield.AbstractFormatterFactory() {
        @Override
        public AbstractFormatter getFormatter(jformattedtextfield tf) {
            return new jformattedtextfield.AbstractFormatter() {
                @Override
                public Object stringTovalue(String text) throws ParseException {
                    return ((TickSpinnerModel)getModel()).stringToTicks(text);
                }
                @Override
                public String valuetoString(Object value) throws ParseException {
                    return ((TickSpinnerModel)getModel()).ticksToString((Long)value);
                }
            };
        }
    });
    ftf.addCaretListener(this);
}
项目:BitcoinWallet    文件EditInputVerifier.java   
/**
 * Verify the input text.  An empty text string is allowed for an optional field.
 * The text is not valid if the formatter throws a parse exception.
 *
 * @param       input       Input component
 * @return                  TRUE if the input text is valid
 */
@Override
public boolean verify(JComponent input) {
    boolean allow = true;
    if (input instanceof jformattedtextfield) {
        jformattedtextfield textField = (jformattedtextfield)input;
        AbstractFormatter formatter = textField.getFormatter();
        if (formatter != null) {
            String value = textField.getText();
            if (value.length() != 0) {
                try {
                    formatter.stringTovalue(value);
                } catch (ParseException exc) {
                    allow = false;
                }
            } else if (!optionalField) {
                allow = false;
            }
        }
    }

    return allow;
}
项目:JamVM-PH    文件DefaultFormatterFactory.java   
/**
 * Returns the appropriate formatter based on the state of 
 * <code>tf</code>. If <code>tf<code> is null we return null,otherwise
 * we return one of the following:
 * 1. Returns <code>nullFormatter</code> if <code>tf.getValue()</code> is 
 * null and <code>nullFormatter</code> is not.  
 * 2. Returns <code>editFormatter</code> if <code>tf.hasFocus()</code> is
 * true and <code>editFormatter</code> is not null.
 * 3. Returns <code>displayFormatter</code> if <code>tf.hasFocus()</code> is
 * false and <code>displayFormatter</code> is not null.
 * 4. Otherwise returns <code>defaultFormatter</code>.
 */
public AbstractFormatter getFormatter(jformattedtextfield tf)
{
  if (tf == null)
    return null;

  if (tf.getValue() == null && nullFormatter != null)
    return nullFormatter;

  if (tf.hasFocus() && editFormatter != null)
    return editFormatter;

  if (!tf.hasFocus() && displayFormatter != null)
    return displayFormatter;

  return defaultFormatter;
}
项目:MyMoney    文件EditInputVerifier.java   
/**
 * Verify the input text.  An empty text string is allowed for an optional field.
 * The text is not valid if the formatter throws a parse exception.
 *
 * @param       input       Input component
 * @return                  TRUE if the input text is valid
 */
public boolean verify(JComponent input) {
    boolean allow = true;
    if (input instanceof jformattedtextfield) {
        jformattedtextfield textField = (jformattedtextfield)input;
        AbstractFormatter formatter = textField.getFormatter();
        if (formatter != null) {
            String value = textField.getText();
            if (value.length() != 0) {
                try {
                    formatter.stringTovalue(value);
                } catch (ParseException exc) {
                    allow = false;
                }
            } else if (!optionalField) {
                allow = false;
            }
        }
    }

    return allow;
}
项目:classpath    文件DefaultFormatterFactory.java   
/**
 * Returns the appropriate formatter based on the state of
 * <code>tf</code>. If <code>tf<code> is null we return null,otherwise
 * we return one of the following:
 * 1. Returns <code>nullFormatter</code> if <code>tf.getValue()</code> is
 * null and <code>nullFormatter</code> is not.
 * 2. Returns <code>editFormatter</code> if <code>tf.hasFocus()</code> is
 * true and <code>editFormatter</code> is not null.
 * 3. Returns <code>displayFormatter</code> if <code>tf.hasFocus()</code> is
 * false and <code>displayFormatter</code> is not null.
 * 4. Otherwise returns <code>defaultFormatter</code>.
 */
public AbstractFormatter getFormatter(jformattedtextfield tf)
{
  if (tf == null)
    return null;

  if (tf.getValue() == null && nullFormatter != null)
    return nullFormatter;

  if (tf.hasFocus() && editFormatter != null)
    return editFormatter;

  if (!tf.hasFocus() && displayFormatter != null)
    return displayFormatter;

  return defaultFormatter;
}
项目:SweetHome3D    文件AutoCommitSpinner.java   
/**
 * Sets the format used to display the value of this spinner.
 */
public void setFormat(Format format)
{
    JComponent editor = getEditor();
    if (editor instanceof JSpinner.DefaultEditor)
    {
        jformattedtextfield textField = ((JSpinner.DefaultEditor) editor).getTextField();
        AbstractFormatter formatter = textField.getFormatter();
        if (formatter instanceof NumberFormatter)
        {
            ((NumberFormatter) formatter).setFormat(format);
            fireStateChanged();
        }
    }
}
项目:swingx    文件JXDatePicker.java   
/**
 * Returns an array of the formats used by the installed formatter
 * if it is a subclass of <code>JXDatePickerFormatter<code>.
 * <code>javax.swing.jformattedtextfield.AbstractFormatter</code>
 * and <code>javax.swing.text.DefaultFormatter</code> do not have
 * support for accessing the formats used.
 *
 * @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;
}
项目:AppWoksUtils    文件SizeSpinner.java   
/**
 * @param model
 */
public SizeSpinner(final SpinnerNumberModel model) {
    super(model);

    // this.addFocusListener(this);
    this.nm = (SpinnerNumberModel) super.getModel();

    final DefaultFormatterFactory factory = new DefaultFormatterFactory(new AbstractFormatter() {

        private static final long serialVersionUID = 7808117078307243989L;

        @Override
        public Object stringTovalue(final String text) throws ParseException {
            return SizeSpinner.this.textToObject(text);
        }

        @Override
        public String valuetoString(final Object value) throws ParseException {

            return SizeSpinner.this.longToText(((Number) value).longValue());
        }

    });
    ((JSpinner.DefaultEditor) this.getEditor()).getTextField().setFormatterFactory(factory);
    ((JSpinner.DefaultEditor) this.getEditor()).getTextField().addFocusListener(this);
    ((JSpinner.DefaultEditor) this.getEditor()).getTextField().addActionListener(this);
}
项目:Converterapp    文件ConverterView.java   
@Override
        public AbstractFormatter getFormatter(jformattedtextfield tf) {
            NumberFormat format = DecimalFormat.getInstance();
//            format.setMinimumIntegerDigits(0);
            format.setMinimumFractionDigits(1); //set minimum decimal place
            format.setMaximumFractionDigits(maximumFractionDigits); //set maximum decimal place
            format.setRoundingMode(RoundingMode.HALF_UP); //set rounding decimal method

            InternationalFormatter formatter = new InternationalFormatter(format);
            formatter.setAllowsInvalid(false);

            return formatter;
        }
项目:aibench-project    文件JXDatePicker.java   
/**
 * Returns an array of the formats used by the installed formatter
 * if it is a subclass of <code>JXDatePickerFormatter<code>.
 * <code>javax.swing.jformattedtextfield.AbstractFormatter</code>
 * and <code>javax.swing.text.DefaultFormatter</code> do not have
 * support for accessing the formats used.
 *
 * @return array of formats guaranteed to be not null,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;
}
项目:aibench-project    文件BasicDatePickerUI.java   
/**
 * Checks and returns custom formats on the editor,if any.
 * 
 * @param editor the editor to check
 * @return the custom formats uses in the editor or null if it had
 *   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);
            if (!(formatter instanceof DatePickerFormatterUIResource))  {
                formats = ((DatePickerFormatter) formatter).getFormats();
            }
        }

    }
    return formats;
}
项目:ireport-fork    文件DaterangeDatePicker.java   
/**
 * Returns an array of the formats used by the installed formatter
 * if it is a subclass of <code>JXDatePickerFormatter<code>.
 * <code>javax.swing.jformattedtextfield.AbstractFormatter</code>
 * and <code>javax.swing.text.DefaultFormatter</code> do not have
 * support for accessing the formats used.
 *
 * @return array of formats or null if unavailable.
 */
public DateFormat[] getFormats() {
    // Dig this out from the factory,otherwise return null.
    AbstractFormatterFactory factory = _dateField.getFormatterFactory();
    if (factory != null) {
        AbstractFormatter formatter = factory.getFormatter(_dateField);
        if (formatter instanceof JXDatePickerFormatter) {
            return ((JXDatePickerFormatter)formatter).getFormats();
        }
    }
    return null;
}
项目:cn1    文件JSpinnerTest.java   
public void testListEditor_formatter() throws Exception {
    JComponent comp = new JButton();
    Object[] values = { "arrline1","arrline2","text",new Integer(33),comp };
    spinner.setModel(new SpinnerListModel(values));
    ListEditor listEditor = new ListEditor(spinner);
    spinner.setEditor(listEditor);
    AbstractFormatter formatter = ((ListEditor) spinner.getEditor()).getTextField()
            .getFormatter();
    assertEquals(formatter.valuetoString(null),"");
    assertEquals(formatter.valuetoString(new Integer(33)),"33");
    assertEquals(formatter.stringTovalue("text"),"text");
}
项目:spring-rich-client    文件FormattedTextFieldAdapterTests.java   
public AbstractFormatter getFormatter(jformattedtextfield tf) {
    return new AbstractFormatter() {

        public Object stringTovalue(String text) throws ParseException {
            if (text != null && !text.equals(text.toLowerCase())) {
                throw new ParseException(text,0);
            }
            return text;
        }

        public String valuetoString(Object value) throws ParseException {
            return (String) value;
        }
    };
}
项目:freeVM    文件JSpinnerTest.java   
public void testListEditor_formatter() throws Exception {
    JComponent comp = new JButton();
    Object[] values = { "arrline1","text");
}
项目:spring-richclient    文件FormattedTextFieldAdapterTests.java   
public AbstractFormatter getFormatter(jformattedtextfield tf) {
    return new AbstractFormatter() {

        public Object stringTovalue(String text) throws ParseException {
            if (text != null && !text.equals(text.toLowerCase())) {
                throw new ParseException(text,0);
            }
            return text;
        }

        public String valuetoString(Object value) throws ParseException {
            return (String) value;
        }
    };
}
项目:Techscore    文件Factory.java   
/**
 * Creates and returns a formatted text field with the formatter
 * specified and the original text specified,and with the default
 * parameters. Registers the focus listener specified with the
 * jformattedtextfield created.
 *
 * @param value  the formatter to use
 * @param format the original value
 * @param flt    the FocusListener object
 */
public static jformattedtextfield formattedField(Object value,AbstractFormatter format,FocusListener flt) {
  jformattedtextfield t = new jformattedtextfield(format);
  t.addFocusListener(flt);
  t.setValue(value);
  t.setColumns(20);
  t.setMinimumSize(new Dimension(30,20));

  return t;
}
项目:TerraJ    文件FormattedTextFieldVerifier.java   
/**
 * Called to verify the state of the component
 *
 * @param input The input component
 * @return <pre>true</pre> if the input is in a valid state for the component
 */
public boolean verify(JComponent input)
{
    if (input instanceof jformattedtextfield)
    {
        final jformattedtextfield ftf = (jformattedtextfield) input;

        final AbstractFormatter formatter = ftf.getFormatter();

        if (formatter != null)
        {
            final String text = ftf.getText();

            try
            {
                formatter.stringTovalue(text);

                return true;
            }
            catch (ParseException pe)
            {
                // not a valid value
                return false;
            }
        }
    }

    return true;
}
项目:jnami    文件HalbjahrComponent.java   
public HalbjahrEditor(JSpinner spinner) {
    super(spinner);

    if (!(spinner.getModel() instanceof HalbjahrModel)) {
        throw new IllegalArgumentException("model not a HalbjahrModel");
    }

    AbstractFormatter formatter = new HalbjahrFormatter();
    jformattedtextfield ftf = getTextField();
    ftf.setEditable(true);
    ftf.setFormatterFactory(new DefaultFormatterFactory(formatter));
    ftf.setColumns(6);
}
项目:JRLib    文件ScaleSpinner.java   
private void initEditorField() {
    jformattedtextfield text = ((JSpinner.DefaultEditor)super.getEditor()).getTextField();
    text.setEditable(false);
    text.setFormatterFactory(new jformattedtextfield.AbstractFormatterFactory() {
        @Override
        public AbstractFormatter getFormatter(jformattedtextfield tf) {
            return new scaleformatter();
        }
    });
    text.setColumns(5);
}
项目:incubator-netbeans    文件SplashUISupport.java   
FontFormatter(AbstractFormatter deleg) {
    setoverwriteMode(false);
    this.deleg = deleg;
}
项目:rapidminer    文件CellTypeTextFieldDefaultImpl.java   
/**
 * Creates a {@link jformattedtextfield} for the specified cell. If a formatter is given,will
 * apply it to the field. Does not validate the model,so make sure this call works!
 * 
 * @param model
 * @param rowIndex
 * @param columnIndex
 * @param cellClass
 * @param formatter
 *            the formatter or <code>null</code> if none is required
 * @param hideUnavailableContentAssist
 * @return
 */
public CellTypeTextFieldDefaultImpl(final TablePanelModel model,final int rowIndex,final int columnIndex,final Class<? extends CellType> cellClass,AbstractFormatter formatter,boolean hideUnavailableContentAssist) {
    super();

    final jformattedtextfield field = CellTypeImplHelper.createFormattedTextField(model,rowIndex,columnIndex);
    setLayout(new BorderLayout());
    add(field,BorderLayout.CENTER);

    // otherwise 'null' would be restored
    Object value = model.getValueAt(rowIndex,columnIndex);
    String text = value != null ? String.valueOf(value) : "";

    // specical handling when formatter is given
    if (formatter != null) {
        field.setFormatterFactory(new DefaultFormatterFactory(formatter));
    }
    field.setText(text);

    // set Syntax assist if available
    String SyntaxHelp = model.getSyntaxHelpAt(rowIndex,columnIndex);
    if (SyntaxHelp != null && !"".equals(SyntaxHelp.trim())) {
        PromptSupport.setForeground(Color.LIGHT_GRAY,field);
        PromptSupport.setPrompt(SyntaxHelp,field);
        PromptSupport.setFontStyle(Font.ITALIC,field);
        PromptSupport.setFocusBehavior(FocusBehavior.SHOW_PROMPT,field);
    }

    // see if content assist is possible for this field,if so add it
    ImageIcon icon = SwingTools.createIcon("16/"
            + I18N.getMessageOrNull(I18N.getGUIBundle(),"gui.action.content_assist.icon"));
    JButton contentAssistButton = new JButton();
    contentAssistButton.setIcon(icon);
    if (field.isEnabled() && model.isContentAssistPossibleForCell(rowIndex,columnIndex)) {
        contentAssistButton.setToolTipText(I18N.getMessageOrNull(I18N.getGUIBundle(),"gui.action.content_assist_enabled.tip"));
        CellTypeImplHelper.addContentAssist(model,columnIndex,field,contentAssistButton,cellClass);
    } else {
        contentAssistButton.setToolTipText(I18N.getMessageOrNull(I18N.getGUIBundle(),"gui.action.content_assist_disabled.tip"));
        contentAssistButton.setEnabled(false);
    }
    if (contentAssistButton.isEnabled() || (!contentAssistButton.isEnabled() && !hideUnavailableContentAssist)) {
        add(contentAssistButton,BorderLayout.EAST);
    }

    // set size so panels don't grow larger when they get the chance
    setPreferredSize(new Dimension(300,20));
    setMinimumSize(new Dimension(100,15));
    setMaximumSize(new Dimension(1600,30));
}
项目:javify    文件DefaultFormatterFactory.java   
/**
 * Gets the formatter to use if the value of the jformattedtextfield is null.
 * @return the formatter to use for null values.
 */
public AbstractFormatter getNullFormatter()
{
  return nullFormatter;
}
项目:rapidminer-studio    文件CellTypeTextFieldDefaultImpl.java   
/**
 * Creates a {@link jformattedtextfield} for the specified cell. If a formatter is given,30));
}
项目:jvm-stm    文件DefaultFormatterFactory.java   
/**
 * Gets the formatter to use if the value of the jformattedtextfield is null.
 * @return the formatter to use for null values.
 */
public AbstractFormatter getNullFormatter()
{
  return nullFormatter;
}
项目:swingx    文件BasicDatePickerUI.java   
public DefaultEditor(AbstractFormatter formatter) {
    super(formatter);
}
项目:swingx    文件DatePickerDemo.java   
private void configureComponents() {
    dateEchoField.setEditable(false);
    AbstractFormatter formatter = new DateFormatter(DateFormat.getDateTimeInstance());
    AbstractFormatterFactory tf = new DefaultFormatterFactory(formatter);
    dateEchoField.setFormatterFactory(tf);
}
项目:aibench-project    文件BasicDatePickerUI.java   
public DefaultEditor(AbstractFormatter formatter) {
    super(formatter);
}
项目:JamVM-PH    文件DefaultFormatterFactory.java   
/**
 * Gets the formatter to use if the value of the jformattedtextfield is null.
 * @return the formatter to use for null values.
 */
public AbstractFormatter getNullFormatter()
{
  return nullFormatter;
}
项目:classpath    文件DefaultFormatterFactory.java   
/**
 * Gets the formatter to use if the value of the jformattedtextfield is null.
 * @return the formatter to use for null values.
 */
public AbstractFormatter getNullFormatter()
{
  return nullFormatter;
}
项目:Techscore    文件DateEditField.java   
/**
 * Creates a new <code>DateEditField</code> instance.
 *
 */
public DateEditField(jformattedtextfield.AbstractFormatter format) {
  super(format);
  this.addFocusListener(this);
}
项目:javify    文件DefaultFormatterFactory.java   
/**
 * Creates a new DefaultFormatterFactory with the specified formatters.
 * @param defaultFormat the formatter to use if no other appropriate non-null
 * formatted can be found.
 * @param displayFormat the formatter to use if the jformattedtextfield
 * doesn't have focus and either the value is not null or the value is null
 * but no <code>nullFormatter</code> has been specified.
 */
public DefaultFormatterFactory(AbstractFormatter defaultFormat,AbstractFormatter displayFormat)
{
  defaultFormatter = defaultFormat;
  displayFormatter = displayFormat;
}
项目:javify    文件DefaultFormatterFactory.java   
/**
 * Creates a new DefaultFormatterFactory with the specified formatters.
 * @param defaultFormat the formatter to use if no other appropriate non-null
 * formatted can be found.
 * @param displayFormat the formatter to use if the jformattedtextfield
 * doesn't have focus and either the value is not null or the value is null
 * but no <code>nullFormatter</code> has been specified.
 * @param editFormat the formatter to use if the jformattedtextfield has
 * focus and either the value is not null or the value is null but not
 * <code>nullFormatter</code> has been specified.
 */
public DefaultFormatterFactory(AbstractFormatter defaultFormat,AbstractFormatter displayFormat,AbstractFormatter editFormat)
{
  defaultFormatter = defaultFormat;
  displayFormatter = displayFormat;
  editFormatter = editFormat;
}
项目:javify    文件DefaultFormatterFactory.java   
/**
 * Creates a new DefaultFormatterFactory with the specified formatters.
 * @param defaultFormat the formatter to use if no other appropriate non-null
 * formatted can be found.
 * @param displayFormat the formatter to use if the jformattedtextfield
 * doesn't have focus and either the value is not null or the value is null
 * but no <code>nullFormatter</code> has been specified.
 * @param editFormat the formatter to use if the jformattedtextfield has
 * focus and either the value is not null or the value is null but not
 * <code>nullFormatter</code> has been specified.
 * @param nullFormat the formatter to use when the value of the
 * jformattedtextfield is null.
 */
public DefaultFormatterFactory(AbstractFormatter defaultFormat,AbstractFormatter editFormat,AbstractFormatter nullFormat)
{
  defaultFormatter = defaultFormat;
  displayFormatter = displayFormat;
  editFormatter = editFormat;
  nullFormatter = nullFormat;
}
项目:jvm-stm    文件DefaultFormatterFactory.java   
/**
 * Creates a new DefaultFormatterFactory with the specified formatters.
 * @param defaultFormat the formatter to use if no other appropriate non-null
 * formatted can be found.
 * @param displayFormat the formatter to use if the jformattedtextfield 
 * doesn't have focus and either the value is not null or the value is null
 * but no <code>nullFormatter</code> has been specified.
 */
public DefaultFormatterFactory(AbstractFormatter defaultFormat,AbstractFormatter displayFormat)
{
  defaultFormatter = defaultFormat;
  displayFormatter = displayFormat;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。