1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.gui.component;
21
22 import javax.swing.Action;
23 import javax.swing.JMenu;
24
25 import org.xnap.gui.util.IconHelper;
26
27 /***
28 * This class provides a menu button with an appropriate sized icon.
29 */
30 public class XNapMenu extends JMenu
31 {
32
33
34
35
36
37 public String filename;
38
39
40
41 public XNapMenu(Action action)
42 {
43 super(action);
44 this.filename = (String)action.getValue(IconHelper.XNAP_ICON);
45 setIcon(IconHelper.getMenuIcon(filename));
46 }
47
48 public XNapMenu(String s, String filename)
49 {
50 super(s);
51 this.filename = filename;
52 setIcon(IconHelper.getMenuIcon(filename));
53 }
54
55 public XNapMenu(String s)
56 {
57 super(s);
58 setIcon(IconHelper.getMenuIcon(null));
59 }
60
61
62
63 public String getIconFilename()
64 {
65 return filename;
66 }
67
68 }