01: /*
02: * Copyright (c) 2005, romain guy (romain.guy@jext.org) and craig wickesser (craig@codecraig.com)
03: * All rights reserved.
04: *
05: * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
06: *
07: * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
08: * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
09: * * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10: *
11: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
12: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
13: * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
14: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
15: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
16: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
18: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20: * POSSIBILITY OF SUCH DAMAGE.
21: */
22:
23: package net.java.swingfx.rubberband.rubberbands;
24:
25: import java.awt.Graphics;
26: import java.util.EventObject;
27:
28: import net.java.swingfx.rubberband.canvas.RubberBandCanvas;
29:
30: /**
31: * A {@link RubberBand} which is rectangular
32: *
33: * @author rwickesser
34: * @since 1.0
35: * $Revision: 1.1 $
36: */
37: public class RectangularRubberBand extends AbstractRubberBand {
38:
39: /**
40: * Creates a new rubber band which is rectangular
41: *
42: * @param canvas the canvas to draw the rubber band on
43: */
44: public RectangularRubberBand(RubberBandCanvas canvas) {
45: super (canvas);
46: }
47:
48: /* (non-Javadoc)
49: * @see gui.rubberband.RubberBand#update(int, int, int, int)
50: */
51: public void update(int x, int y, int width, int height) {
52: rubberband.setBounds(x, y, width, height);
53: }
54:
55: /* (non-Javadoc)
56: * @see gui.rubberband.RubberBand#draw(java.awt.Graphics)
57: */
58: public void draw(Graphics g) {
59: g.drawRect(rubberband.x, rubberband.y, rubberband.width,
60: rubberband.height);
61: }
62:
63: /* (non-Javadoc)
64: * @see RubberBand#startRubberBand(java.util.EventObject)
65: */
66: public void startRubberBand(EventObject event) {
67: // don't need to do anything here
68: }
69:
70: /* (non-Javadoc)
71: * @see RubberBand#stopRubberBand(java.util.EventObject)
72: */
73: public void stopRubberBand(EventObject event) {
74: // don't need to do anything here
75: }
76:
77: /* (non-Javadoc)
78: * @see RubberBand#updateRubberBand(java.util.EventObject)
79: */
80: public void updateRubberBand(EventObject event) {
81: // don't need to do anything specific here for this rubber band
82: }
83: }
|