00001 package edu.stanford.hci.r3.events.replay;
00002
00003 import java.awt.BasicStroke;
00004 import java.awt.Color;
00005 import java.awt.Graphics2D;
00006
00007 import javax.swing.BoundedRangeModel;
00008
00009 import edu.stanford.hci.r3.util.DebugUtils;
00010 import edu.stanford.hci.r3.util.MathUtils;
00011 import edu.stanford.hci.r3.util.components.JRangeSlider;
00012
00023 public class EventSlider extends JRangeSlider {
00024
00025 final BasicStroke centerStroke = new BasicStroke(2);
00026
00032 public EventSlider(BoundedRangeModel model, int orientation, int direction) {
00033 super(model, orientation, direction);
00034 }
00035
00036
00037
00038
00039
00040
00041 protected void customPaint(Graphics2D g, int width, int height) {
00042 final int lo = toScreen(getLowValue());
00043 final int hi = toScreen(getHighValue());
00044 final int min = toScreen(getMinimum());
00045 final int max = toScreen(getMaximum());
00046 final int range = max - min;
00047 final int xCenter = MathUtils.rint((hi - lo) / 2.0 + lo - 1);
00048
00049
00050 DebugUtils.println("lo: " + lo + " hi: " + hi);
00051 DebugUtils.println("x: " + xCenter + " " + height);
00052 g.setColor(Color.DARK_GRAY);
00053 g.setStroke(centerStroke);
00054 g.drawLine(xCenter, 0, xCenter, height);
00055 }
00056 }