Import java.awt.event. *;
XL class frames implement item listener// excuse.
{
Static selection chc = newchoice (); //Create the object of the drop-down box.
}
Public static void main(String args[])
{
frm . set layout(new FlowLayout()); //Create a layout format
frm.setSize(200,200); //Set the frame size
frm . add(chc); //Add a drop-down box component to the frame.
chc . additem listener(frm); //Set chc as a listener
Chc.add ('Shanghai');
Chc.add ('Beijing'); //Add what you need in the drop-down box, such as Shanghai and Beijing.
frm . set visible(true); //Make the form visible
}
//The next step is to trigger the drop-down box for execution.