Write a program to develop a frame to select different states in India using JComboBox in JavaProgramming

import javax.swing.*;   
public class CB2 {   
 
CB2(){   
  JFrame f=new JFrame();   
    String s[]={"Maharashtra","Punjab","Gujrat","TamilNadu"};       
    JComboBox cb=new JComboBox(s);   
    cb.setBounds(50, 50,90,20);   
    f.add(cb);       
    f.setLayout(null);   
    f.setSize(400,400);   
    f.setVisible(true);       
}   
public static void main(String[] args) {   
    new CB2();       
}   
}

OP:

Comments