1 17 18 19 20 package org.apache.fop.render.awt.viewer; 21 22 import java.awt.event.ActionEvent ; 24 import javax.swing.AbstractAction ; 25 import javax.swing.ImageIcon ; 26 import java.net.URL ; 27 28 40 public class Command extends AbstractAction { 41 42 private static final String IMAGE_DIR = "images/"; 43 44 50 public Command(String name, int mnemonic) { 51 super(name); 52 putValue(SHORT_DESCRIPTION, name); 53 if (mnemonic > 0) { 54 putValue(MNEMONIC_KEY, new Integer (mnemonic)); 55 } 56 } 57 58 64 public Command(String name, String iconName) { 65 super(name); 66 putValue(SHORT_DESCRIPTION, name); 67 URL url = getClass().getResource(IMAGE_DIR + iconName + ".gif"); 68 if (url != null) { 69 putValue(SMALL_ICON, new ImageIcon (url)); 70 } 71 } 72 73 76 public void actionPerformed(ActionEvent e) { 77 doit(); 78 } 79 80 83 public void doit() { 84 } 86 } 87 88 | Popular Tags |