Package javax.swing

Examples of javax.swing.JFormattedTextField$DocumentListenerImpl


        super(new JFormattedTextField(formatter));
        df = (JFormattedTextField)getComponent();
        df.setFocusLostBehavior(JFormattedTextField.PERSIST);
    }
    public FormattedCellEditor(AbstractFormatterFactory factory) {
        super(new JFormattedTextField(factory));
        df = (JFormattedTextField)getComponent();
    }
View Full Code Here


    public FormattedCellEditor(AbstractFormatterFactory factory) {
        super(new JFormattedTextField(factory));
        df = (JFormattedTextField)getComponent();
    }
    public FormattedCellEditor(DocumentFilter filter) {
        super(new JFormattedTextField(filter));
        df = (JFormattedTextField)getComponent();
        ((DataFieldFormatter)df.getFormatter()).setFilter(filter);
        ((DataFieldFormatter)df.getFormatter()).install(df);
    }
View Full Code Here

    private JFormattedTextField textField;

    public JFormattedTextFieldEditor()
    {
        textField = new JFormattedTextField();
        textField.setFocusLostBehavior(JFormattedTextField.PERSIST);
    }
View Full Code Here

        this.textField.setFocusLostBehavior(JFormattedTextField.PERSIST);
    }

    public JFormattedTextFieldEditor(DefaultFormatter formatter)
    {
        textField = new JFormattedTextField(formatter);
        textField.setFocusLostBehavior(JFormattedTextField.PERSIST);
    }
View Full Code Here

//            }
//        });
    }
   
    public FormattedCellEditor(AbstractFormatter formatter) {
        super(new JFormattedTextField(formatter));
        df = (JFormattedTextField)getComponent();
        df.setFocusLostBehavior(JFormattedTextField.PERSIST);
    }
View Full Code Here

        super(new JFormattedTextField(formatter));
        df = (JFormattedTextField)getComponent();
        df.setFocusLostBehavior(JFormattedTextField.PERSIST);
    }
    public FormattedCellEditor(AbstractFormatterFactory factory) {
        super(new JFormattedTextField(factory));
        df = (JFormattedTextField)getComponent();
    }
View Full Code Here

    public FormattedCellEditor(AbstractFormatterFactory factory) {
        super(new JFormattedTextField(factory));
        df = (JFormattedTextField)getComponent();
    }
    public FormattedCellEditor(DocumentFilter filter) {
        super(new JFormattedTextField(filter));
        df = (JFormattedTextField)getComponent();
        ((DataFieldFormatter)df.getFormatter()).setFilter(filter);
        ((DataFieldFormatter)df.getFormatter()).install(df);
    }
View Full Code Here

    private JFormattedTextField textField;

    public JFormattedTextFieldEditor()
    {
        textField = new JFormattedTextField();
        textField.setFocusLostBehavior(JFormattedTextField.PERSIST);
    }
View Full Code Here

        this.textField.setFocusLostBehavior(JFormattedTextField.PERSIST);
    }

    public JFormattedTextFieldEditor(DefaultFormatter formatter)
    {
        textField = new JFormattedTextField(formatter);
        textField.setFocusLostBehavior(JFormattedTextField.PERSIST);
    }
View Full Code Here

          // System.out.println("Initial text = " + text);
//          String charsToRemove;
          // If the user is trying to backspace over a special character, like a comma, we don't
          // allow it, but instead move to the previous number. This only applies if the dot and mark
          // of the filter are the same (ie, they don't have a highlighted selection)
          JFormattedTextField comp = this.field;
          if (length == 1 && comp.getCaret().getDot() == comp.getCaret().getMark()) {
            while (offset >= 0 && !Character.isDigit(text.charAt(offset))) {
              offset--;
            }
            if (offset < 0) {
              // Nothing to do
              return;
            }
//            else {
//              charsToRemove = text.substring(offset, offset + length);
//            }
          }
//          else {
//             charsToRemove = text.substring(offset, offset + length);
//          }
          // System.out.println("Chars to remove = " + charsToRemove);
          try {
          Object o = comp.getFormatter().stringToValue(text);
          String value = text;
          // TF:11/04/2008: Check for null coming back in case it's a widget mapped to
          // a nullable field with a null value
          if (o != null) {
            value = o.toString();
            // System.out.println(o.toString() + " - " + o.getClass().toString());
            char[] chars = text.toCharArray();
            int srcIndex = offset-1;
            int destIndex = offset + length-1;
            while (destIndex >= 0) {
              if (Character.isDigit(chars[destIndex])) {
                //need to replace this digit with another one
                while (srcIndex >= 0 && !Character.isDigit(chars[srcIndex])) {
                  srcIndex--;
                }
                if (srcIndex >= 0) {
                  // Replace this index with the source digit
                  chars[destIndex] = chars[srcIndex];
                  // Now drop the source index back one
                  srcIndex--;
                }
                else {
                  // No character, must replace with 0
                  chars[destIndex] = '0';
                }
              }
              destIndex--;
            }
            // System.out.println("Current dot at:" + this.field.getCaret().getDot());
            // System.out.println("Current mark at:" + this.field.getCaret().getMark());
            // System.out.println("New value = " + new String(chars));
            o = comp.getFormatter().stringToValue(new String(chars));
          }
          value = comp.getFormatter().valueToString(o);
              int lengthToReplace = getReplaceToOffset(text, value);
             
              lengthToReplace = Math.max(length + offset, lengthToReplace);
              // System.out.println("new value = " + value);
              // System.out.println("replacement length(" + text + ", " + value + ") = " + lengthToReplace);
View Full Code Here

TOP

Related Classes of javax.swing.JFormattedTextField$DocumentListenerImpl

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.