Mega Code Archive

 
Categories / Java / Swing JFC
 

Input dialog with user-defined logo

import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JOptionPane; public class ComboBoxDialog {   public static void main(String argv[]) {     String[] plays = new String[] { "Hamlet", "King Lear",         "Otello", "Romeo and Juliet" };     String input = (String) JOptionPane.showInputDialog(         new JFrame(),         "Please select your favorite Shakespeare play",         "Title", JOptionPane.INFORMATION_MESSAGE,         new ImageIcon("rntsoftLogo.GIF"), plays, "Romeo and Juliet");     System.out.println("User's input: " + input);   } }