Package javax.swing.JFormattedTextField

Examples of javax.swing.JFormattedTextField.AbstractFormatter


        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");
    }
View Full Code Here


   */
  @Override
  public boolean verify(JComponent input) {
        if (input instanceof JFormattedTextField) {
            JFormattedTextField ftf = (JFormattedTextField)input;
            AbstractFormatter formatter = ftf.getFormatter();
            if (formatter != null) {
                String text = ftf.getText();
                if(!text.trim().equals("")){
                   try {
                        formatter.stringToValue(text);
                        return true;
                    } catch (ParseException pe) {
                        int response = JOptionPane.showConfirmDialog(
                            MainGui.desktop,
                  this.message,
View Full Code Here

TOP

Related Classes of javax.swing.JFormattedTextField.AbstractFormatter

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.