Basically I’ve been experimenting with the use of drop-boxes in a GUI I’m making in netbeans. I know how easy it is to obtain a string variable from a text field using the .getText() method, however I would like to get a value that a user selects from a drop-down menu (i.e. the combo box), hits a ‘submit’ button (which the actionPerformed method is attached to) and place it in a string variable.
This would allow me to use this string variable to pass into a set() method in another class.
This is an annoying little problem but I expected there to be a few when I started.
Any help appreciated.
Try
And perhaps the following snipped might be useful to get the string.
to get the selected item.