IOapalooza4.java
Select all
/* IOapalooza4.java CIS 260 David Klick 2006-01-18 This program demonstrates how a JOptionPane can be used for slightly more complex tasks than it usually is asked to do. */ import javax.swing.*; public class IOapalooza4 { public static void main(String[] args) { Object[] classes = {"CIS 101", "CIS 123", "CIS 170", "CIS 250", "CIS 260"}; String strIn = (String) JOptionPane.showInputDialog( null, "What is your favorite class?", "Complex Dialog", JOptionPane.PLAIN_MESSAGE, null, // no custom icon classes, classes[4]); if ((strIn != null) && (strIn.length() > 0)) { JOptionPane.showMessageDialog(null, "I like " + strIn + " too!"); } else { JOptionPane.showMessageDialog(null, "You should have made a choice!"); } System.exit(0); } }