Java tutorial
import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JOptionPane; public class Main { public static void main(String[] args) { JComponent parentComponent = null; Object message = "Please select"; String title = "JOptionPane Input Dialog"; int messageType = JOptionPane.INFORMATION_MESSAGE; Icon icon = null; Object[] selectionValues = new String[] { "A", "B", "C" }; Object initialSelectionValue = selectionValues[2]; Object response = JOptionPane.showInputDialog(parentComponent, message, title, messageType, icon, selectionValues, initialSelectionValue); if (response == null) { System.out.println("we have cancelled the input dialog."); } else { System.out.println("we entered: " + response); } } }