rendered paste bodyimport java.awt.BorderLayout;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.WindowConstants;
public class test extends javax.swing.JFrame {
private JComboBox jComboBox1 = new JComboBox();;
public test() {
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
jComboBox1.setEditable(true);
jComboBox1.addFocusListener(new FocusListener(){
public void focusGained(FocusEvent evt){
System.out.println("Focus on JComboBox gained");
}
public void focusLost(FocusEvent evt){
System.out.println("Focs on JCombBox lost");
}
});
getContentPane().add(jComboBox1, BorderLayout.CENTER);
pack();
}
public static void main(String args[]) {
final JFrame frame = new test();
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
frame.setVisible(true);
}
});
}
}