Perry Smith

Java Questions & Answers

Home / Java Q & A Page 2 / Java Q & A Archive Main Page

Drop down menus
Tuesday, 17-Nov-98 13:46:57
134.129.169.227 writes:

I'm need to know how to create a dropdown menu and then store the user
selection as a variable

I've created the menus but I can't get the selection to store.

Thanks for the help

Funkdaddy

Re: Drop down menus
Tuesday, 17-Nov-98 15:09:43
148.5.110.65 writes:

Funkdaddy,

If you create an ItemListener, in your itemStateChanged method you can
put code similar to that shown below. anItemEvent is the event passed in
to the itemStateChanged method.

int theSelectionIndex =
((Choice)anItemEvent.getItemSelectable()). getSelectedIndex();

Scott



Home / Java Q & A Page 2 / Java Q & A Archive Main Page