Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.27 KB | None | 0 0
  1. String[] petStrings = { "Bird", "Cat", "Dog", "Rabbit", "Pig" };
  2.  
  3. //Create the combo box, select item at index 4.
  4. //Indices start at 0, so 4 specifies the pig.
  5. JComboBox petList = new JComboBox(petStrings);
  6. petList.setSelectedIndex(4);
  7. petList.addActionListener(this);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement