wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Jcombobox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Jcombobox" Watch "Jcombobox" New topic
Author

Jcombobox

Bhuvan mehra
Ranch Hand

Joined: Mar 29, 2002
Posts: 69
JComboBox.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent e) {
System.out.println("DDDDDDDDDD");
}
});
it is not working. pls. write if i am missing any step.
thanks.
regadrs,
bhuvan.
Uma Y
Greenhorn

Joined: Mar 25, 2002
Posts: 7
Here's what the Java Swing tutorial says about JComboBox handling focus event
"Although JComboBox inherits methods to register listeners for low-level events -- focus, key, and mouse events, for example -- we recommend that you don't listen for low-level events on a combo box. Here's why: A combo box is a compound component -- it is comprised of two or more other components. The combo box itself fires high-level events such as action events. Its subcomponents fire low-level events such as mouse, key, and focus events. The low-level events and the subcomponent that fires them are look-and-feel-dependent. To avoid writing look-and-feel-dependent code, you should listen only for high-level events on a compound component such as a combo box."
hope this helps!!
Uma
Bhuvan mehra
Ranch Hand

Joined: Mar 29, 2002
Posts: 69
thanks and regards,
bhuvan.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Jcombobox