1 package net.sf.openrocket.gui.figureelements;
5 import java.awt.Graphics2D;
6 import java.awt.Rectangle;
7 import java.awt.geom.AffineTransform;
8 import java.awt.geom.Area;
10 public abstract class Caret implements FigureElement {
14 * Creates a new caret at the specified coordinates.
16 public Caret(double x, double y) {
22 * Sets the position of the caret to the new coordinates.
24 public void setPosition(double x, double y) {
30 * Paints the caret to the Graphics2D element.
32 public void paint(Graphics2D g2, double scale) {
33 Area caret = getCaret();
34 AffineTransform t = new AffineTransform(1.0/scale, 0, 0, 1.0/scale, x, y);
37 g2.setColor(getColor());
42 public void paint(Graphics2D g2, double scale, Rectangle visible) {
43 throw new UnsupportedOperationException("paint() with rectangle unsupported.");
47 * Return the Area object corresponding to the mark.
49 protected abstract Area getCaret();
52 * Return the color to be used when drawing the mark.
54 protected abstract Color getColor();