10 date 2008.04.30.14.29.05; author rmh3093; state Exp;
36 import java.awt.event.ActionEvent;
41 public class DialogViewer extends JPanel {
43 public void actionPerformed(ActionEvent e) {
44 System.out.println(e.getSource().toString());
48 * Create new DialogViewer
49 * @@param type display type
51 public DialogViewer(char[] type){
55 JFileChooser filechooser = new JFileChooser();
56 ret = filechooser.showOpenDialog(DialogViewer.this);
57 if (ret == JFileChooser.APPROVE_OPTION) {
58 File file = filechooser.getSelectedFile();
59 System.out.println(file.getName());
61 System.out.println("No file was chosen!");
65 JOptionPane confirmation = new JOptionPane();
66 ret = confirmation.showConfirmDialog(DialogViewer.this,
69 case 0: System.out.println("Yes"); break;
70 case 1: System.out.println("No"); break;
71 case 2: System.out.println("Cancel"); break;
75 JOptionPane.showMessageDialog(DialogViewer.this, "Ryan Hope");
83 public static void main(String args[]) {
84 if (args.length==1 && args[0].length()==1) {
85 new DialogViewer(args[0].toCharArray());
87 System.out.println("Usage: java DialogViewer [f|c|m]");