editable JComboBox
问题 I have editable JComboBox and wish to add values to it from its input,e.s when I typing something in JComboBox and press enter I want that text appear in JComboBox list : public class Program extends JFrame implements ActionListener { private JComboBox box; public static void main(String[] args) { new Program().setVisible(true); } public Program() { super("Text DEMO"); setSize(300, 300); setLayout(new FlowLayout()); Container cont = getContentPane(); box = new JComboBox(new String[] { "First"