import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Main extends JFrame{
JComboBox<String> com=new JComboBox<String>();
JTextField text=new JTextField(20);
public Main() {
setVisible(true);
setSize(500,350);
Container c=getContentPane();
c.setLayout(new FlowLayout());
c.add(text);
c.add(com);
text.addActionListener(new ac());
}
class ac implements ActionListener{
public void actionPerformed(ActionEvent e) {
com.add(text.getText());
}
}
public static void main(String[] args) {
new Main();
}
}