KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > swt > widgets > Monitor


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.widgets;
12
13 import org.eclipse.swt.graphics.*;
14
15 /**
16  * Instances of this class are descriptions of monitors.
17  *
18  * @see Display
19  *
20  * @since 3.0
21  */

22 public final class Monitor {
23     int handle;
24     int x, y, width, height;
25     int clientX, clientY, clientWidth, clientHeight;
26     
27 /**
28  * Prevents uninitialized instances from being created outside the package.
29  */

30 Monitor () {
31 }
32     
33 /**
34  * Compares the argument to the receiver, and returns true
35  * if they represent the <em>same</em> object using a class
36  * specific comparison.
37  *
38  * @param object the object to compare with this object
39  * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
40  *
41  * @see #hashCode()
42  */

43 public boolean equals (Object JavaDoc object) {
44     if (object == this) return true;
45     if (!(object instanceof Monitor)) return false;
46     Monitor monitor = (Monitor) object;
47     return handle == monitor.handle;
48 }
49
50 /**
51  * Returns a rectangle describing the receiver's size and location
52  * relative to its device.
53  *
54  * @return the receiver's bounding rectangle
55  */

56 public Rectangle getBounds () {
57     return new Rectangle (x, y, width, height);
58 }
59     
60 /**
61  * Returns a rectangle which describes the area of the
62  * receiver which is capable of displaying data.
63  *
64  * @return the client area
65  */

66 public Rectangle getClientArea () {
67     return new Rectangle (clientX, clientY, clientWidth, clientHeight);
68 }
69     
70 /**
71  * Returns an integer hash code for the receiver. Any two
72  * objects that return <code>true</code> when passed to
73  * <code>equals</code> must return the same value for this
74  * method.
75  *
76  * @return the receiver's hash
77  *
78  * @see #equals(Object)
79  */

80 public int hashCode () {
81     return handle;
82 }
83
84 }
85
Popular Tags