class FenCombo extends JFrame implements ActionListener, ItemListener { public FenCombo() { setTitle("Combined box try"); setSize(300,200); Container contenu = getContentPane(); contenu.setLayout(new FlowLayour()); combo = new JComboBox(colours); combo.setEditable(true); contenu.add(combo); combo.addActionListener(this); combo.addItemListener(this); } public void ActionPerformed (ActionEvent e) { System.out.print("action combo: "); Object valeur = combo.getSelectedItem(); System.out.println((String) valeur); } public void ItemStateChanged (ItemEvent e) { System.out.print("item combo: "); Object valeur = combo.getSelectedItem(); System.out.println((String) valeur); } private String[] colours = {"red", "blue", "grey", "green", "yellow", "black"}; private JComboBox combo; } public class Combo { public static void main (String args[]) { FenCombo fen = new FenCombo(); fen.setVisible(true); } }