01:
02: /*
03: * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
04: * for visualizing and manipulating spatial features with geometry and attributes.
05: *
06: * Copyright (C) 2003 Vivid Solutions
07: *
08: * This program is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU General Public License
10: * as published by the Free Software Foundation; either version 2
11: * of the License, or (at your option) any later version.
12: *
13: * This program is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: * GNU General Public License for more details.
17: *
18: * You should have received a copy of the GNU General Public License
19: * along with this program; if not, write to the Free Software
20: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21: *
22: * For more information, contact:
23: *
24: * Vivid Solutions
25: * Suite #1A
26: * 2328 Government Street
27: * Victoria BC V8T 5G5
28: * Canada
29: *
30: * (250)385-6040
31: * www.vividsolutions.com
32: */
33:
34: package com.vividsolutions.wms.ui;
35:
36: import java.awt.*;
37:
38: /**
39: * A simple canvas which draws a given image in the upper left corner of itself.
40: *
41: * @author Chris Hodgson chodgson@refractions.net
42: */
43: public class ImageCanvas extends Canvas {
44:
45: Image img;
46:
47: /**
48: * Creates a new instance of ImageCanvas.
49: */
50: public ImageCanvas() {
51: super ();
52: }
53:
54: /**
55: * Sets the Image to be displayed on the canvas.
56: * @param img the Image to be displayed
57: */
58: public void setImage(Image img) {
59: this .img = img;
60: }
61:
62: /**
63: * Paints its Image (if specified) in the upper-left hand corner of itself.
64: * @param g the Graphics object on which to paint.
65: */
66: public void paint(Graphics g) {
67: if (img != null) {
68: g.drawImage(img, 0, 0, this);
69: }
70: }
71: }
|