If you
are using the Metal Look and feel, you have to actually register the focus
listener with the button on the combo box since it is what gets the
focus.
class MyCombo extends JComboBox {
private boolean bFocusable = false;
public MyCombo() {
JButton theButton = null;
Component[] theComponents = getComponents();
for ( int index=0;index<theComponents.length;index++ )
if ( theComponents[index] instanceof JButton ) {
theButton = (JButton) theComponents[index];
}
}
theButton.addFocusListener(new FocusAdapter() {public void focusGained(FocusEvent fe) {
System.out.println("abhay: focus gained");
}
});
It is
ugly, but it does work... You should check if the ui is a MetalUI as
well...
____________________________________________________-----Original Message-----Sorry about being tangible in the previous mail as
From: abhay [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 17, 2002 9:57 PM
To: JDJList
Subject: [jdjlist] focus problem
i had to rush home yesterday.
Coming back to the problem , even
though focusGained method is not invoked, the focus
does appear on the comboBox. When I tab out from various
components, the purplish blue line appears on the combo. When
i press space bar the combo box opens. This means my simulated
'setFocusable() ' doesn't work.
Please suggest any workarounds.regards
abhay ____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm
Be respectful! Clean up your posts before replying
____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm
Be respectful! Clean up your posts before replying
____________________________________________________
