javax.swing.JFormattedTextField#AbstractFormatter ( )源码实例Demo

下面列出了javax.swing.JFormattedTextField#AbstractFormatter ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * Returns either the default formatter, display formatter, editor
 * formatter or null formatter based on the state of the
 * JFormattedTextField.
 *
 * @param source JFormattedTextField requesting
 *               JFormattedTextField.AbstractFormatter
 * @return JFormattedTextField.AbstractFormatter to handle
 *         formatting duties.
 */
public JFormattedTextField.AbstractFormatter getFormatter(
                 JFormattedTextField source) {
    JFormattedTextField.AbstractFormatter format = null;

    if (source == null) {
        return null;
    }
    Object value = source.getValue();

    if (value == null) {
        format = getNullFormatter();
    }
    if (format == null) {
        if (source.hasFocus()) {
            format = getEditFormatter();
        }
        else {
            format = getDisplayFormatter();
        }
        if (format == null) {
            format = getDefaultFormatter();
        }
    }
    return format;
}
 
源代码2 项目: jdk8u60   文件: DefaultFormatterFactory.java
/**
 * Creates a DefaultFormatterFactory with the specified
 * JFormattedTextField.AbstractFormatters.
 *
 * @param defaultFormat JFormattedTextField.AbstractFormatter to be used
 *                      if a more specific
 *                      JFormattedTextField.AbstractFormatter can not be
 *                      found.
 * @param displayFormat JFormattedTextField.AbstractFormatter to be used
 *                      when the JFormattedTextField does not have focus.
 * @param editFormat    JFormattedTextField.AbstractFormatter to be used
 *                      when the JFormattedTextField has focus.
 * @param nullFormat    JFormattedTextField.AbstractFormatter to be used
 *                      when the JFormattedTextField has a null value.
 */
public DefaultFormatterFactory(
              JFormattedTextField.AbstractFormatter defaultFormat,
              JFormattedTextField.AbstractFormatter displayFormat,
              JFormattedTextField.AbstractFormatter editFormat,
              JFormattedTextField.AbstractFormatter nullFormat) {
    this.defaultFormat = defaultFormat;
    this.displayFormat = displayFormat;
    this.editFormat = editFormat;
    this.nullFormat = nullFormat;
}
 
源代码3 项目: openjdk-jdk9   文件: DefaultFormatterFactory.java
/**
 * Creates a DefaultFormatterFactory with the specified
 * JFormattedTextField.AbstractFormatters.
 *
 * @param defaultFormat JFormattedTextField.AbstractFormatter to be used
 *                      if a more specific
 *                      JFormattedTextField.AbstractFormatter can not be
 *                      found.
 * @param displayFormat JFormattedTextField.AbstractFormatter to be used
 *                      when the JFormattedTextField does not have focus.
 * @param editFormat    JFormattedTextField.AbstractFormatter to be used
 *                      when the JFormattedTextField has focus.
 */
public DefaultFormatterFactory(
               JFormattedTextField.AbstractFormatter defaultFormat,
               JFormattedTextField.AbstractFormatter displayFormat,
               JFormattedTextField.AbstractFormatter editFormat) {
    this(defaultFormat, displayFormat, editFormat, null);
}
 
源代码4 项目: Bytecoder   文件: DefaultFormatterFactory.java
/**
 * Sets the formatter to use if the value of the JFormattedTextField is
 * null.
 *
 * @param atf JFormattedTextField.AbstractFormatter to use when
 * the value of the JFormattedTextField is null.
 */
public void setNullFormatter(JFormattedTextField.AbstractFormatter atf) {
    nullFormat = atf;
}
 
源代码5 项目: hottub   文件: DefaultFormatterFactory.java
/**
 * Sets the <code>JFormattedTextField.AbstractFormatter</code> to use as
 * a last resort, eg in case a display, edit or null
 * <code>JFormattedTextField.AbstractFormatter</code> has not been
 * specified.
 *
 * @param atf JFormattedTextField.AbstractFormatter used if a more
 *            specific is not specified
 */
public void setDefaultFormatter(JFormattedTextField.AbstractFormatter atf){
    defaultFormat = atf;
}
 
源代码6 项目: jdk8u-jdk   文件: DefaultFormatterFactory.java
/**
 * Returns the <code>JFormattedTextField.AbstractFormatter</code> to use
 * if the <code>JFormattedTextField</code> is not being edited and either
 * the value is not-null, or the value is null and a null formatter has
 * has not been specified.
 *
 * @return JFormattedTextField.AbstractFormatter to use when the
 *         JFormattedTextField does not have focus
 */
public JFormattedTextField.AbstractFormatter getDisplayFormatter() {
    return displayFormat;
}
 
源代码7 项目: jdk8u_jdk   文件: DefaultFormatterFactory.java
/**
 * Creates a <code>DefaultFormatterFactory</code> with the specified
 * <code>JFormattedTextField.AbstractFormatter</code>s.
 *
 * @param defaultFormat JFormattedTextField.AbstractFormatter to be used
 *                      if a more specific
 *                      JFormattedTextField.AbstractFormatter can not be
 *                      found.
 * @param displayFormat JFormattedTextField.AbstractFormatter to be used
 *                      when the JFormattedTextField does not have focus.
 */
public DefaultFormatterFactory(
                 JFormattedTextField.AbstractFormatter defaultFormat,
                 JFormattedTextField.AbstractFormatter displayFormat) {
    this(defaultFormat, displayFormat, null);
}
 
源代码8 项目: openjdk-8   文件: DefaultFormatterFactory.java
/**
 * Creates a <code>DefaultFormatterFactory</code> with the specified
 * <code>JFormattedTextField.AbstractFormatter</code>.
 *
 * @param defaultFormat JFormattedTextField.AbstractFormatter to be used
 *                      if a more specific
 *                      JFormattedTextField.AbstractFormatter can not be
 *                      found.
 */
public DefaultFormatterFactory(JFormattedTextField.
                                   AbstractFormatter defaultFormat) {
    this(defaultFormat, null);
}
 
/**
 * Returns the <code>JFormattedTextField.AbstractFormatter</code> to use
 * if the <code>JFormattedTextField</code> is not being edited and either
 * the value is not-null, or the value is null and a null formatter has
 * has not been specified.
 *
 * @return JFormattedTextField.AbstractFormatter to use when the
 *         JFormattedTextField does not have focus
 */
public JFormattedTextField.AbstractFormatter getDisplayFormatter() {
    return displayFormat;
}
 
/**
 * Sets the <code>JFormattedTextField.AbstractFormatter</code> to use if
 * the <code>JFormattedTextField</code> is being edited and either
 * the value is not-null, or the value is null and a null formatter has
 * has not been specified.
 *
 * @param atf JFormattedTextField.AbstractFormatter to use when the
 *            component has focus
 */
public void setEditFormatter(JFormattedTextField.AbstractFormatter atf) {
    editFormat = atf;
}
 
源代码11 项目: openjdk-jdk9   文件: DefaultFormatterFactory.java
/**
 * Creates a <code>DefaultFormatterFactory</code> with the specified
 * <code>JFormattedTextField.AbstractFormatter</code>s.
 *
 * @param defaultFormat JFormattedTextField.AbstractFormatter to be used
 *                      if a more specific
 *                      JFormattedTextField.AbstractFormatter can not be
 *                      found.
 * @param displayFormat JFormattedTextField.AbstractFormatter to be used
 *                      when the JFormattedTextField does not have focus.
 */
public DefaultFormatterFactory(
                 JFormattedTextField.AbstractFormatter defaultFormat,
                 JFormattedTextField.AbstractFormatter displayFormat) {
    this(defaultFormat, displayFormat, null);
}
 
源代码12 项目: jdk8u_jdk   文件: DefaultFormatterFactory.java
/**
 * Creates a <code>DefaultFormatterFactory</code> with the specified
 * <code>JFormattedTextField.AbstractFormatter</code>.
 *
 * @param defaultFormat JFormattedTextField.AbstractFormatter to be used
 *                      if a more specific
 *                      JFormattedTextField.AbstractFormatter can not be
 *                      found.
 */
public DefaultFormatterFactory(JFormattedTextField.
                                   AbstractFormatter defaultFormat) {
    this(defaultFormat, null);
}
 
源代码13 项目: jdk8u-dev-jdk   文件: DefaultFormatterFactory.java
/**
 * Creates a <code>DefaultFormatterFactory</code> with the specified
 * <code>JFormattedTextField.AbstractFormatter</code>.
 *
 * @param defaultFormat JFormattedTextField.AbstractFormatter to be used
 *                      if a more specific
 *                      JFormattedTextField.AbstractFormatter can not be
 *                      found.
 */
public DefaultFormatterFactory(JFormattedTextField.
                                   AbstractFormatter defaultFormat) {
    this(defaultFormat, null);
}
 
源代码14 项目: dragonwell8_jdk   文件: DefaultFormatterFactory.java
/**
 * Returns the formatter to use if the value is null.
 *
 * @return JFormattedTextField.AbstractFormatter to use when the value is
 *         null
 */
public JFormattedTextField.AbstractFormatter getNullFormatter() {
    return nullFormat;
}
 
源代码15 项目: TencentKona-8   文件: DefaultFormatterFactory.java
/**
 * Creates a <code>DefaultFormatterFactory</code> with the specified
 * <code>JFormattedTextField.AbstractFormatter</code>s.
 *
 * @param defaultFormat JFormattedTextField.AbstractFormatter to be used
 *                      if a more specific
 *                      JFormattedTextField.AbstractFormatter can not be
 *                      found.
 * @param displayFormat JFormattedTextField.AbstractFormatter to be used
 *                      when the JFormattedTextField does not have focus.
 */
public DefaultFormatterFactory(
                 JFormattedTextField.AbstractFormatter defaultFormat,
                 JFormattedTextField.AbstractFormatter displayFormat) {
    this(defaultFormat, displayFormat, null);
}
 
源代码16 项目: jdk8u60   文件: DefaultFormatterFactory.java
/**
 * Returns the formatter to use if the value is null.
 *
 * @return JFormattedTextField.AbstractFormatter to use when the value is
 *         null
 */
public JFormattedTextField.AbstractFormatter getNullFormatter() {
    return nullFormat;
}
 
源代码17 项目: openjdk-jdk9   文件: DefaultFormatterFactory.java
/**
 * Sets the <code>JFormattedTextField.AbstractFormatter</code> to use if
 * the <code>JFormattedTextField</code> is being edited and either
 * the value is not-null, or the value is null and a null formatter has
 * has not been specified.
 *
 * @param atf JFormattedTextField.AbstractFormatter to use when the
 *            component has focus
 */
public void setEditFormatter(JFormattedTextField.AbstractFormatter atf) {
    editFormat = atf;
}
 
源代码18 项目: Java8CN   文件: DefaultFormatterFactory.java
/**
 * Returns the <code>JFormattedTextField.AbstractFormatter</code> to use
 * if the <code>JFormattedTextField</code> is not being edited and either
 * the value is not-null, or the value is null and a null formatter has
 * has not been specified.
 *
 * @return JFormattedTextField.AbstractFormatter to use when the
 *         JFormattedTextField does not have focus
 */
public JFormattedTextField.AbstractFormatter getDisplayFormatter() {
    return displayFormat;
}
 
源代码19 项目: Bytecoder   文件: DefaultFormatterFactory.java
/**
 * Returns the <code>JFormattedTextField.AbstractFormatter</code> to use
 * if the <code>JFormattedTextField</code> is being edited and either
 * the value is not-null, or the value is null and a null formatter has
 * has not been specified.
 *
 * @return JFormattedTextField.AbstractFormatter to use when the
 *         component has focus
 */
public JFormattedTextField.AbstractFormatter getEditFormatter() {
    return editFormat;
}
 
源代码20 项目: dragonwell8_jdk   文件: DefaultFormatterFactory.java
/**
 * Sets the <code>JFormattedTextField.AbstractFormatter</code> to use if
 * the <code>JFormattedTextField</code> is not being edited and either
 * the value is not-null, or the value is null and a null formatter has
 * has not been specified.
 *
 * @param atf JFormattedTextField.AbstractFormatter to use when the
 *            JFormattedTextField does not have focus
 */
public void setDisplayFormatter(JFormattedTextField.AbstractFormatter atf){
    displayFormat = atf;
}