Java tutorial
import javax.swing.JComboBox; import javax.swing.JOptionPane; public class Main { public static void main(String[] args) { Object[] options = { "Option 1", "Option 2", "Option 3", "None of the above" }; JComboBox optionControl = new JComboBox(options); optionControl.setSelectedIndex(3); JOptionPane.showMessageDialog(null, optionControl, "Option", JOptionPane.QUESTION_MESSAGE); System.out.println(optionControl.getSelectedItem()); String graphSelection = (String) JOptionPane.showInputDialog(null, "Choose from the following options...", "Choose From DropDown", JOptionPane.QUESTION_MESSAGE, null, options, options[3]); System.out.println(graphSelection); JOptionPane.showMessageDialog(null, optionControl, "Option", JOptionPane.QUESTION_MESSAGE); } }