KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > nightlabs > util > bean > propertyeditor > PaintableEditor


1 /* ************************************************************************** *
2  * Copyright (C) 2004 NightLabs GmbH, Marco Schulze *
3  * All rights reserved. *
4  * http://www.NightLabs.de *
5  * *
6  * This program and the accompanying materials are free software; you can re- *
7  * distribute it and/or modify it under the terms of the GNU General Public *
8  * License as published by the Free Software Foundation; either ver 2 of the *
9  * License, or any later version. *
10  * *
11  * This module is distributed in the hope that it will be useful, but WITHOUT *
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FIT- *
13  * NESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more *
14  * details. *
15  * *
16  * You should have received a copy of the GNU General Public License along *
17  * with this module; if not, write to the Free Software Foundation, Inc.: *
18  * 59 Temple Place, Suite 330 *
19  * Boston MA 02111-1307 *
20  * USA *
21  * *
22  * Or get it online: *
23  * http://www.opensource.org/licenses/gpl-license.php *
24  * *
25  * In case, you want to use this module or parts of it in a proprietary pro- *
26  * ject, you can purchase it under the NightLabs Commercial License. Please *
27  * contact NightLabs GmbH under info AT nightlabs DOT com for more infos or *
28  * visit http://www.NightLabs.com *
29  * ************************************************************************** */

30
31 /*
32  * <p>Title: NightLabsEditor2DClient</p>
33  * <p>Description: User Interaction of the NL 2D Editor Engine</p>
34  * <p>Copyright: Copyright (c) 2004</p>
35  * <p>Company: NightLabs GmbH</p>
36  * @author Daniel Mazurek
37  * @version 1.0
38  */

39
40 package com.nightlabs.util.bean.propertyeditor;
41
42 import java.awt.Component JavaDoc;
43 import java.awt.Dimension JavaDoc;
44 import java.awt.Graphics JavaDoc;
45 import java.awt.Rectangle JavaDoc;
46 import java.beans.PropertyEditor JavaDoc;
47
48 /**
49  * @author Daniel Mazurek
50  */

51 public class PaintableEditor
52 extends Component JavaDoc
53 {
54     /** Paintable PropertyEditor */
55     PropertyEditor JavaDoc editor;
56
57     /**
58      * Rectangle where value is painted
59      */

60     Rectangle JavaDoc rect = new Rectangle JavaDoc(0, 0, 0, 0);
61
62     /**
63      * Default Constructor
64      */

65     public PaintableEditor(PropertyEditor JavaDoc editor){
66         this.editor = editor;
67     }
68
69     public void paint(Graphics JavaDoc g)
70     {
71         Dimension JavaDoc size = getSize();
72         rect.width = size.width;
73         rect.height = rect.height;
74         editor.paintValue(g, rect);
75     }
76 }
77
Popular Tags