summaryrefslogtreecommitdiff
path: root/java/gjt/DrawingPanel.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/gjt/DrawingPanel.java')
-rw-r--r--java/gjt/DrawingPanel.java72
1 files changed, 0 insertions, 72 deletions
diff --git a/java/gjt/DrawingPanel.java b/java/gjt/DrawingPanel.java
deleted file mode 100644
index cda3fd69431..00000000000
--- a/java/gjt/DrawingPanel.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package gjt;
-
-import java.awt.*;
-import gjt.rubberband.*;
-
-/**
- * An extension of gjt.rubberband.RubberbandPanel which serves
- * as a panel used for drawing simple shapes (lines, rectangles,
- * and ellipses). The shapes may be filled (except for lines,
- * of course), and the color of the shapes may be specified.<p>
- *
- * @version 1.0, Apr 1 1996
- * @author David Geary
- * @see gjt.rubberband.RubberbandPanel
- * @see gjt.rubberband.RubberbandEllipse
- * @see gjt.rubberband.RubberbandLine
- * @see gjt.rubberband.RubberbandRectangle
- * @see gjt.test.RubberbandTest
- * @see gjt.test.ToolbarTest
- */
-public class DrawingPanel extends RubberbandPanel {
- private Rubberband rbLine, rbRect, rbEllipse;
- private Color color;
- private boolean fill;
-
- public DrawingPanel() {
- rbLine = new RubberbandLine (this);
- rbRect = new RubberbandRectangle(this);
- rbEllipse = new RubberbandEllipse (this);
-
- setRubberband(rbLine);
- }
- public void drawLines () { setRubberband(rbLine); }
- public void drawRectangles() { setRubberband(rbRect); }
- public void drawEllipses () { setRubberband(rbEllipse); }
-
- public void setColor(Color color) { this.color = color; }
- public Color getColor() { return color; }
-
- public void setFill(boolean b) { fill = b; }
- public boolean getFill() { return fill; }
-
- public boolean mouseUp(Event event, int x, int y) {
- Rubberband rb = getRubberband();
- Graphics g = getGraphics();
-
- super.mouseUp(event, x, y);
- g.setColor(color);
-
- if(rb == rbLine) drawLine (rb, g);
- else if(rb == rbRect) drawRectangle(rb, g);
- else if(rb == rbEllipse) drawEllipse (rb, g);
-
- return true;
- }
- protected void drawLine(Rubberband rb, Graphics g) {
- Point anchor = rb.getAnchor(), end = rb.getEnd();
- g.drawLine(anchor.x, anchor.y, end.x, end.y);
- }
- protected void drawRectangle(Rubberband rb, Graphics g) {
- Rectangle r = rb.bounds();
-
- if(fill) g.fillRect(r.x, r.y, r.width, r.height);
- else g.drawRect(r.x, r.y, r.width, r.height);
- }
- protected void drawEllipse(Rubberband rb, Graphics g) {
- Rectangle r = rb.bounds();
-
- if(fill) g.fillArc(r.x, r.y, r.width, r.height, 0, 360);
- else g.drawArc(r.x, r.y, r.width, r.height, 0, 360);
- }
-}