rendered paste body/*
* DialogViewer.java
*
* Version:
* $Id$
*
* Revisions:
* $Log$
*/
import javax.swing.*; import java.awt.*;
public class DialogViewer{
public static void main( String args[] ){
if ( args.length != 1 ){
System.err.println("must supply argument as 'f', 'c', or 'm'");
return;
}
final String input = args[0];
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
show( input );
}
});
}
public static void show( String a ){
JFrame win = null;
if ( a == "f" ){
JFileChooser chooser = new JFileChooser();
int retVal = chooser.showOpenDialog( win );
if ( retVal == JFileChooser.CANCEL_OPTION ){
System.out.println("You didn't select a file");
}
}
if ( a == "c" ){
JOptionPane chooser = new JOptionPane();
int retVal = chooser.showConfirmDialog( win, "Are you Sure?" );
if ( retVal == JFileChooser.CANCEL_OPTION ){
System.out.println("You pressed Cancel.");
}
}
if ( a == "m" ){
JOptionPane chooser = new JOptionPane();
chooser.showMessageDialog( win, "Mike Edmister" );
}
}
}