1 package org.catacomb.druid.swing;
2
3 import java.awt.Color;
4
5 import javax.swing.JSlider;
6 import javax.swing.event.ChangeEvent;
7 import javax.swing.event.ChangeListener;
8
9 import org.catacomb.druid.event.LabelActor;
10 import org.catacomb.interlish.interact.DComponent;
11
12
13 public class DSimpleSlider extends JSlider implements DComponent, ChangeListener {
14
15 LabelActor labelActor;
16
17 public DSimpleSlider(int min, int max, String label) {
18 super(min, max);
19 addChangeListener(this);
20 }
21
22
23 public void setLabelActor(LabelActor lact) {
24 labelActor = lact;
25 }
26
27
28 private void notifyChange() {
29 if (labelActor != null) {
30 labelActor.labelAction("change", true);
31 }
32 }
33
34
35 public int getSliderValue() {
36 return getValue();
37 }
38
39 public void export() {
40 notifyChange();
41 }
42
43
44 public void stateChanged(ChangeEvent e) {
45 notifyChange();
46 }
47
48
49 public void setTooltip(String s) {
50 super.setToolTipText(s);
51 }
52
53
54 public void setBg(Color c) {
55 setBackground(c);
56
57 }
58
59 }