Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: a strange question about itemevent

 
steven Gu
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I meet a stange question:
First I have a nameCheckBox , a nameJTextField and a locationCheckBox , a locationJTextField and a JComboBox include two items 'and' , 'or' .
Second I write a JTFieldFocusListener implements FocusListener and
a CheckBoxListener implements ItemListener;
Third I made :
nameBox.addItemListener(myBListener);
locationBox.addItemListener(myBListener);
nameField.addFocusListener(myJTFocusListener);
locationField.addFocusListener(myJTFocusListener);
At last , when nameBox was selected , nameField was setEditable;
when locationBox was selected , locationField was setEditable.

But When I run , I cann't set mouse to focus into nameField or loactionField once I change item of JComboBox. I only can put mouse out of
the GUI and put into the GUI again , then I can put mouse into field again.
Why ? can anyone help me ?
Thanks very much! please quick!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic