Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8120738

When requesting focus on a focusproperty changed listener, javafx gives focus to two different controls

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • fx2.0.2
    • javafx
    • Windows 8
      jre 7
      javafx 2

          private void fillPerson()
      {
          try
          {
              this.selectedPerson=new PersonController().getOne(NuInt.safeParse((this.txtIdPerson.getText())));
              if(this.selectedPerson.getId()!=0)
              {
                  this.txtPersonName.setText(this.selectedPerson.getName());
                  this.txtZoneName.setText(this.selectedPerson.getZona().getName());
                  this.txtCompanyName.setText(this.selectedPerson.getCompany().getName());
              }
              else
              {
                  this.txtPersonName.setText("");
                  this.txtZoneName.setText("");
                  this.txtCompanyName.setText("");
                  this.txtIdPerson.requestFocus(); <------------------------------------------------------------------------ This produces the dual focus
              }

          }

          private class FocusListener implements ChangeListener<Boolean>
      {
          private TripFrmController trip;
          public FocusListener(TripFrmController Trip)
          {
              this.trip=trip;
          }


          @Override
          public void changed(ObservableValue<? extends Boolean> ov, Boolean prevVal, Boolean newVal)
          {
              if (!newVal)
              {
                  this.trip.fillPerson();
              }
          }

      }

      This code makes two TextField controls get focus at the same time.
      Screenshot of the result:
      http://i.stack.imgur.com/RszF9.png

            miflemi Mick Fleming
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: