当前位置: 技术问答>java相关
60分问一简单JComboBox问题,送分!
来源: 互联网 发布时间:2015-01-26
本文导语: comboBox1.addFocusListener(); ComboBox为何不能触发 Focus 事件(focusLost and focusGained ) ?? 请问能触发吗? | jComboBox1.setBounds(new Rectangle(236, 138, 126, 22)); jComboBox1.addFocusListener(new java.awt.event.FocusAdapter() {...
comboBox1.addFocusListener();
ComboBox为何不能触发 Focus 事件(focusLost and focusGained ) ??
请问能触发吗?
|
jComboBox1.setBounds(new Rectangle(236, 138, 126, 22));
jComboBox1.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(FocusEvent e) {
jComboBox1_focusGained(e);
}
});
this.getContentPane().add(jComboBox1, null);
}
void jComboBox1_focusGained(FocusEvent e) {
}
jComboBox1.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(FocusEvent e) {
jComboBox1_focusGained(e);
}
});
this.getContentPane().add(jComboBox1, null);
}
void jComboBox1_focusGained(FocusEvent e) {
}
|
JComboBox jc = new JComboBox();
jc.addFocusListener(new FocusAdapter()
{
public void focusGained(FocusEvent e)
{
System.out.println("asdfasdfasdfasdfasdf");
}
});
jc.addFocusListener(new FocusAdapter()
{
public void focusGained(FocusEvent e)
{
System.out.println("asdfasdfasdfasdfasdf");
}
});