KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > swt > events > PaintEvent


1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.swt.events;
12
13
14 import org.eclipse.swt.widgets.Event;
15 import org.eclipse.swt.graphics.GC;
16
17 /**
18  * Instances of this class are sent as a result of
19  * visible areas of controls requiring re-painting.
20  *
21  * @see PaintListener
22  */

23
24 public final class PaintEvent extends TypedEvent {
25     
26     /**
27      * the graphics context to use when painting
28      * that is configured to use the colors, font and
29      * damaged region of the control. It is valid
30      * only during the paint and must not be disposed
31      */

32     public GC gc;
33     
34     /**
35      * the x offset of the bounding rectangle of the
36      * region that requires painting
37      */

38     public int x;
39     
40     /**
41      * the y offset of the bounding rectangle of the
42      * region that requires painting
43      */

44     public int y;
45     
46     /**
47      * the width of the bounding rectangle of the
48      * region that requires painting
49      */

50     public int width;
51     
52     /**
53      * the height of the bounding rectangle of the
54      * region that requires painting
55      */

56     public int height;
57
58     /**
59      * the number of following paint events which
60      * are pending which may always be zero on
61      * some platforms
62      */

63     public int count;
64
65     static final long serialVersionUID = 3256446919205992497L;
66     
67 /**
68  * Constructs a new instance of this class based on the
69  * information in the given untyped event.
70  *
71  * @param e the untyped event containing the information
72  */

73 public PaintEvent(Event e) {
74     super(e);
75     this.gc = e.gc;
76     this.x = e.x;
77     this.y = e.y;
78     this.width = e.width;
79     this.height = e.height;
80     this.count = e.count;
81 }
82
83 /**
84  * Returns a string containing a concise, human-readable
85  * description of the receiver.
86  *
87  * @return a string representation of the event
88  */

89 public String JavaDoc toString() {
90     String JavaDoc string = super.toString ();
91     return string.substring (0, string.length() - 1) // remove trailing '}'
92
+ " gc=" + gc
93         + " x=" + x
94         + " y=" + y
95         + " width=" + width
96         + " height=" + height
97         + " count=" + count
98         + "}";
99 }
100 }
101
102
Popular Tags