
import java.awt.EventQueue;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JPopupMenu;

public class Test4 {

    public static void main(String[] args) {
        EventQueue.invokeLater(() -> gui());
    }

    private static void gui() {
        JFrame f = new JFrame("frame");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        String[] items = { "One", "Two", "Three", "Four", "Five" };

        JComboBox<String> cb = new JComboBox<>(items);
        cb.setEditable(true);
        f.add(cb);

        f.pack();
        f.setLocationRelativeTo(null); 
        f.setVisible(true); 
    } 
}

