Comboxbox_2022
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class l3_combo{
JFrame f;
JLabel lbl;
JComboBox jcb;
String[] countries={"Nepal","China","Malaysia","India","Lanka"};
public l3_combo(){
jcb = new JComboBox(countries);
lbl = new JLabel("Countries");
f = new JFrame();
f.setLayout(new FlowLayout());
f.setSize(400,300);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(lbl);
f.add(jcb);
jcb.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent eee){
f.setTitle(""+jcb.getSelectedItem());
f.setBounds(300,400,300,200);
//f.setVisible(false);
}
});
}
public static void main(String[] anglaiii){
new l3_combo();
}
}