1 51 package org.apache.fop.viewer; 52 57 58 import java.awt.event.ActionEvent ; 59 import org.apache.fop.messaging.MessageHandler; 60 import javax.swing.AbstractAction ; 61 import javax.swing.ImageIcon ; 62 import java.net.*; 63 64 65 75 public class Command extends AbstractAction { 76 77 public static String IMAGE_DIR = "/org/apache/fop/viewer/Images/"; 78 79 public Command(String name) { 80 this(name, (ImageIcon )null); 81 } 82 83 public Command(String name, ImageIcon anIcon) { 84 super(name, anIcon); 85 } 86 87 public Command(String name, String iconName) { 88 super(name); 89 String path = IMAGE_DIR + iconName + ".gif"; 90 URL url = getClass().getResource(path); 91 if (url == null) { 92 MessageHandler.errorln("Icon not found: " + path); 93 } else 94 putValue(SMALL_ICON, new ImageIcon (url)); 95 } 96 97 public void actionPerformed(ActionEvent e) { 98 doit(); 99 } 100 101 public void doit() { 102 MessageHandler.errorln("Not implemented."); 103 } 104 105 public void undoit() { 106 MessageHandler.errorln("Not implemented."); 107 } 108 109 } 110 | Popular Tags |