1 package org.catacomb.druid.gui.base;
2
3
4 import org.catacomb.druid.swing.DLabel;
5 import org.catacomb.icon.DImageIcon;
6 import org.catacomb.icon.IconLoader;
7 import org.catacomb.report.E;
8
9
10 public class DruImageLabelPanel extends DruPanel {
11
12 static final long serialVersionUID = 1001;
13
14 DLabel dLabel;
15
16 String[] tags;
17 DImageIcon[] icons;
18 int nim;
19
20
21 public DruImageLabelPanel() {
22 super();
23 DImageIcon dia = IconLoader.createImageIcon("normal.gif");
24 dLabel = new DLabel(dia);
25 tags = new String[6];
26 icons = new DImageIcon[6];
27 nim = 0;
28 addSingleDComponent(dLabel);
29 }
30
31
32
33
34
35 public void postApply() {
36
37 if (info != null) {
38 dLabel.setMouseActor(this);
39 } else {
40
41 }
42 }
43
44
45
46 public void addImage(String src, String tag) {
47 tags[nim] = tag;
48 icons[nim] = IconLoader.createImageIcon(src);
49 if (nim == 0) {
50 dLabel.setIcon(icons[nim]);
51 }
52 nim++;
53 }
54
55 public void showImage(String s) {
56 boolean done = false;
57 for (int i = 0; i < nim; i++) {
58 if (tags[i].equals(s)) {
59 dLabel.setIcon(icons[i]);
60
61 done = true;
62 break;
63 }
64 }
65 if (!done) {
66 E.warning("cant find tag " + s);
67 }
68 }
69
70 }