1 package org.catacomb.druid.swing; 2 3 4 import org.catacomb.druid.event.LabelActor; 5 import org.catacomb.icon.IconLoader; 6 import org.catacomb.interlish.interact.DComponent; 7 import org.catacomb.interlish.structure.MouseActor; 8 import org.catacomb.report.E; 9 10 11 import java.awt.Font; 12 13 import javax.swing.Icon; 14 import javax.swing.JButton; 15 16 import java.awt.Color; 17 18 19 public abstract class DBaseButton extends JButton implements DComponent { 20 21 protected static final Font plainfont = null; 22 protected static final Font boldfont = null; 23 protected String label; 24 String actionCommand; 25 MouseActor mouseActor; 26 LabelActor lact; 27 28 public void setLabelText(String s) { 29 label = s; 30 setText(s); 31 } 32 33 public void setActionCommand(String s) { 34 actionCommand = s; 35 } 36 37 public void setLabelActor(LabelActor bl) { 38 lact = bl; 39 } 40 41 public void deliverAction(boolean b) { 42 if (lact != null) { 43 lact.labelAction(actionCommand, b); 44 } 45 } 46 47 public void setMouseActor(MouseActor ma) { 48 addMouseListener(new DMouseRelay(ma)); 49 } 50 51 public void setPlainFont() { 52 setFont(new Font("sansserif", Font.PLAIN, 12)); 53 } 54 55 56 public void setBoldFont() { 57 setFont(new Font("sansserif", Font.BOLD, 12)); 58 } 59 60 public abstract void setBg(Color c); 61 62 public abstract void setFg(Color c); 63 64 65 public void setRolloverPolicy(int inorm, int ihover) { 66 E.missing(); 67 } 68 69 public void setPadding(int p) { 70 setPadding(p, p, p, p); 71 72 } 73 74 public void setPadding(int pl, int pr, int pt, int pb) { 75 E.missing(); 76 } 77 78 public void setIconSource(String s) { 79 Icon icon = IconLoader.getImageIcon(s); 80 setIcon(icon); 81 } 82 83 public abstract void suggest(); 84 85 public abstract void deSuggest(); 86 87 88 89 }