package timeflow.vis; import timeflow.model.*; import java.awt.*; import java.util.ArrayList; public class Mouseover extends Rectangle { public Object thing; public Mouseover(Object thing, int x, int y, int w, int h) { super(x,y,w,h); this.thing=thing; } public void draw(Graphics2D g, int maxW, int maxH, Display display) { g.setColor(new Color(0,53,153)); g.setColor(new Color(255,255,0,100)); g.fill(this); } protected void draw(Graphics2D g, int maxW, int maxH, Display display, ArrayList labels, int numLines) { if (labels==null || labels.size()==0) return; // draw a background box. // find max number of chars, very very roughly! int boxW=50; for (int i=0; imaxH-10) { my=Math.max(10,this.y-boxH-5); } if (mx+boxW>maxW-10) { mx=Math.max(10,this.x-boxW-10); } int ty=my; g.setColor(new Color(0,0,0,70)); g.fillRoundRect(mx-11, my-16, boxW, boxH,12,12); g.setColor(Color.white); g.fillRoundRect(mx-15, my-20, boxW, boxH,12,12); g.setColor(Color.darkGray); g.drawRoundRect(mx-15, my-20, boxW, boxH,12,12); // finally, draw the darn labels. for (int i=0; i lines=(ArrayList)o; int dx=sw+9; for (String line: lines) { g.drawString((String)line,mx+dx,ty); ty+=18; dx=0; } ty+=5; } } } }