1 package org.catacomb.druid.swing; 2 3 import org.catacomb.icon.DImageIcon; 4 import org.catacomb.interlish.interact.DComponent; 5 import org.catacomb.interlish.structure.MouseActor; 6 7 import java.awt.Color; 8 import java.awt.Font; 9 10 import javax.swing.JLabel; 11 12 13 public class DLabel extends JLabel implements DComponent { 14 static final long serialVersionUID = 1001; 15 16 static Font plainfont; 17 18 static Font boldfont; 19 20 21 MouseActor mouseActor; 22 String clickReferent; 23 24 public DLabel(DImageIcon dic) { 25 super(dic); 26 } 27 28 public DLabel(String s, int pos) { 29 super(s, pos); 30 setPlainFont(); 31 } 32 33 public DLabel(String s) { 34 super(s); 35 36 setPlainFont(); 37 } 38 39 public void setTooltip(String s) { 40 setToolTipText(s); 41 } 42 43 public void setBg(Color c) { 44 setBackground(c); 45 } 46 47 48 public void setFg(Color c) { 49 setForeground(c); 50 } 51 52 53 54 public void setToolTip(String s) { 55 setToolTipText(s); 56 } 57 58 59 60 public void setMouseActor(MouseActor ma) { 61 addMouseListener(new DMouseRelay(ma)); 62 } 63 64 65 66 public void setPlainFont() { 67 if (plainfont == null) { 68 plainfont = new Font("sansserif", Font.PLAIN, 12); 69 } 70 71 setFont(plainfont); 72 } 73 74 75 public void setFontBold() { 76 setBoldFont(); 77 } 78 79 public void setBoldFont() { 80 if (boldfont == null) { 81 boldfont = new Font("sansserif", Font.BOLD, 12); 82 } 83 setFont(boldfont); 84 } 85 86 }