View Javadoc

1   package org.catacomb.druid.gui.base;
2   
3   
4   import org.catacomb.druid.swing.DLabel;
5   
6   
7   public class DruLabelPanel extends DruPanel {
8   
9       static final long serialVersionUID = 1001;
10  
11      String text;
12  
13      DLabel dLabel;
14  
15      boolean htmlStyle = false;
16  
17      public DruLabelPanel(String lab, String align) {
18          super();
19  
20          text = lab;
21  
22          if (align != null && align.equals("right")) {
23              dLabel = new DLabel(text, DLabel.TRAILING);
24              addSingleDComponent(dLabel);
25  
26          } else {
27              dLabel = new DLabel(text);
28              addSingleDComponent(dLabel);
29          }
30      }
31  
32  
33      public void setText(String s) {
34          text = s;
35          if (htmlStyle && text != null && text.indexOf("<html>") < 0) {
36              dLabel.setText("<html>" + s + "</html>");
37          } else {
38              dLabel.setText(s);
39          }
40      }
41  
42      public void setFontBold() {
43          dLabel.setFontBold();
44      }
45  
46  
47      public void setEnabled(boolean b) {
48          dLabel.setEnabled(b);
49      }
50  
51  
52  
53      public void postApply() {
54  
55          if (info != null) {
56              dLabel.setMouseActor(this);
57          } else {
58  //        E.warning("not bothering with label action as info is null " + text);
59          }
60      }
61  
62  
63      public void setStyleHTML() {
64          htmlStyle = true;
65          setText(text);
66      }
67  
68  
69  }