Combo boxes (drop-down lists):
A combo box is a drop-down list that allows the programmer to specify a number of strings, one of which can be selected. Like the radio buttons, it is a way to force the user to select only one of the options offered. The code for creating a drop-down list is shown below:
JComboBox computerChoice = new JComboBox( );
computerChoice.addItem("VAX");
computerChoice.addItem("PC");
computerChoice.addItem("Mac");
computerChoice.setSelectedItem("VAX");
The first line creates the drop-down list. The next three lines add three strings to the list and the final line sets the first string to be displayed. When the user clicks on the menu all three strings will be displayed and one can be selected.
As with all of the Swing classes there are many methods associated with this class. The most important one is getSelectedItem, which returns the string of the currently selected item. So, for example, the code:
String currentChoice = computerChoice.getSelectedItem( );
results in the string currentChoice being set to the string "VAX".
Java Assignment Help - Java Homework Help
Struggling with java programming language? Are you not finding solution for your Combo boxes (drop-down lists) homework and assignments? Live Combo boxes (drop-down lists) experts are working for students by solving their doubts & questions during their course studies and training program. We at Expertsmind.com offer Combo boxes (drop-down lists) homework help, java assignment help and Combo boxes (drop-down lists) projects help anytime from anywhere for 24x7 hours. Computer science programming assignments help making life easy for students.
Why Expertsmind for assignment help
- Higher degree holder and experienced experts network
- Punctuality and responsibility of work
- Quality solution with 100% plagiarism free answers
- Time on Delivery
- Privacy of information and details
- Excellence in solving java programming language queries in excels and word format.
- Best tutoring assistance 24x7 hours