/** * Create a new BusyPainterUI. * * @param view The view to create the painter to. */ public BusyPainterUI(Component view) { busyPainter = new SimpleBusyPainter(); busyPainter.setPointShape(new Ellipse2D.Double(0, 0, 20, 20)); busyPainter.setTrajectory( new Ellipse2D.Double( view.getWidth() / 4, view.getHeight() / 4, view.getWidth() / 2, view.getHeight() / 2)); timer = new Timer(200, this); }
public BusyPainterUI() { busyPainter = new BusyPainter() { protected void doPaint(Graphics2D g, JComponent object, int width, int height) { // // centralize the effect // Rectangle r = busyPainter.getTrajectory().getBounds(); // int tw = width - r.width - 2 * r.x; // int th = height - r.height - 2 * r.y; // g.translate(tw / 2, th / 2); super.doPaint(g, object, width, height); } }; busyPainter.setPointShape(new Ellipse2D.Double(0, 0, 20, 20)); busyPainter.setTrajectory(new Ellipse2D.Double(0, 0, 100, 100)); busyPainter.setPaintCentered(true); timer = new Timer(100, this); }