Package javax.swing

Examples of javax.swing.JFormattedTextField.commitEdit()


    //of this method so that everything gets cleaned up.
    public boolean stopCellEditing() {
        JFormattedTextField ftf = (JFormattedTextField)getComponent();
        if (ftf.isEditValid()) {
            try {
                ftf.commitEdit();
            } catch (java.text.ParseException exc) { }
           
        } else { //text is invalid
            if (!userSaysRevert()) { //user wants to edit
                return false; //don't let the editor go away
View Full Code Here


      bind().valueOf(textField).to(model, ModelForTests.DATE);
      Calendar calendar = Calendar.getInstance();
      calendar.set(2010, 4, 10);
      // when
      textField.setText(textField.getFormatter().valueToString(calendar.getTime()));
      textField.commitEdit();
      // then
      assertNotNull(model.getDate());
      calendar.setTime(model.getDate());
      assertEquals(2010, calendar.get(Calendar.YEAR));
      assertEquals(4, calendar.get(Calendar.MONTH));
View Full Code Here

        JFormattedTextField text = (JFormattedTextField)obj;
        if(text.isEditValid())
        {
          try
          {
            text.commitEdit();
          }
          catch(ParseException e)
          {
          }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.