1 package org.catacomb.druid.swing; 2 3 4 import java.awt.Color; 5 import java.awt.Dimension; 6 import java.awt.Graphics; 7 8 import javax.swing.JPanel; 9 10 import org.catacomb.interlish.interact.DComponent; 11 12 13 public class DDotsPanel extends JPanel implements DComponent { 14 15 static final long serialVersionUID = 1001; 16 17 18 Dimension pref = new Dimension(100, 1); 19 Dimension max = new Dimension(2000, 1); 20 Dimension min = new Dimension(20, 1); 21 22 Color color; 23 24 25 public DDotsPanel() { 26 color = Color.black; 27 } 28 29 public void setBg(Color c) { 30 color = c.darker(); 31 } 32 33 public void paintComponent(Graphics g) { 34 g.setColor(color); 35 int w = getWidth(); 36 37 for (int i = 10; i < w - 10; i += 15) { 38 g.drawLine(i, 2, i + 5, 2); 39 } 40 } 41 42 43 public void setTooltip(String s) { 44 setToolTipText(s); 45 } 46 47 48 public Dimension getPreferredSize() { 49 return pref; 50 } 51 52 53 public Dimension getMaximumSize() { 54 return max; 55 } 56 57 58 public Dimension getMinimumSize() { 59 return min; 60 } 61 62 63 }