Java Code Examples for javax.swing.JFormattedTextField#getValue()
The following examples show how to use
javax.swing.JFormattedTextField#getValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultFormatterFactory.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 2
Source File: DefaultFormatterFactory.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 3
Source File: DefaultFormatterFactory.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 4
Source File: IntegerEditor.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
@Override public Object getCellEditorValue() { JFormattedTextField textField = (JFormattedTextField) getComponent(); Object o = textField.getValue(); if (o instanceof Integer) { return o; } else if (o instanceof Number) { return ((Number) o).intValue(); } else { try { return integerFormat.parseObject(o.toString()); } catch (ParseException exc) { System.err.println("getCellEditorValue: can't parse o: " + o); return null; } } }
Example 5
Source File: DefaultFormatterFactory.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 6
Source File: DefaultFormatterFactory.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 7
Source File: DefaultFormatterFactory.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 8
Source File: DefaultFormatterFactory.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 9
Source File: DefaultFormatterFactory.java From Java8CN with Apache License 2.0 | 6 votes |
/** * 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; }
Example 10
Source File: LHexaSpinner.java From audiveris with GNU Affero General Public License v3.0 | 6 votes |
@Override public Object stringToValue (String string) throws ParseException { try { JFormattedTextField ftf = getFormattedTextField(); Object value = ftf.getValue(); if (value instanceof Integer) { return Integer.valueOf(string, 16); } else if (value instanceof Long) { return Long.valueOf(string, 16); } else { throw new IllegalArgumentException( "Illegal Number class for HexaFormatter " + value.getClass()); } } catch (NumberFormatException ex) { throw new ParseException(string, 0); } }
Example 11
Source File: DefaultFormatterFactory.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * 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; }
Example 12
Source File: DefaultFormatterFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 13
Source File: DefaultFormatterFactory.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * 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; }
Example 14
Source File: IntegerEditor.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
@Override public Object getCellEditorValue() { JFormattedTextField textField = (JFormattedTextField) getComponent(); Object o = textField.getValue(); if (o instanceof Integer) { return o; } else if (o instanceof Number) { return ((Number) o).intValue(); } else { try { return integerFormat.parseObject(o.toString()); } catch (ParseException exc) { System.err.println("getCellEditorValue: can't parse o: " + o); return null; } } }
Example 15
Source File: IntegerEditor.java From marathonv5 with Apache License 2.0 | 6 votes |
public Object getCellEditorValue() { JFormattedTextField ftf = (JFormattedTextField) getComponent(); Object o = ftf.getValue(); if (o instanceof Integer) { return o; } else if (o instanceof Number) { return new Integer(((Number) o).intValue()); } else { if (DEBUG) { System.out.println("getCellEditorValue: o isn't a Number"); } try { return integerFormat.parseObject(o.toString()); } catch (ParseException exc) { System.err.println("getCellEditorValue: can't parse o: " + o); return null; } } }
Example 16
Source File: DefaultFormatterFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 17
Source File: DefaultFormatterFactory.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * 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; }
Example 18
Source File: DefaultFormatterFactory.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 19
Source File: DefaultFormatterFactory.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 20
Source File: LHexaSpinner.java From libreveris with GNU Lesser General Public License v3.0 | 6 votes |
@Override public Object stringToValue (String string) throws ParseException { try { JFormattedTextField ftf = getFormattedTextField(); Object value = ftf.getValue(); if (value instanceof Integer) { return Integer.valueOf(string, 16); } else if (value instanceof Long) { return Long.valueOf(string, 16); } else { throw new IllegalArgumentException( "Illegal Number class for HexaFormatter " + value.getClass()); } } catch (NumberFormatException ex) { throw new ParseException(string, 0); } }