KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > core > print > cPoint


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
10
//The Original Code is "The Columba Project"
11
//
12
//The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14
//
15
//All Rights Reserved.
16
package org.columba.core.print;
17
18 import java.awt.Point JavaDoc;
19 import java.awt.geom.Point2D JavaDoc;
20
21
22 public class cPoint {
23     private cUnit x;
24     private cUnit y;
25
26     public cPoint(cUnit x, cUnit y) {
27         this.x = x;
28         this.y = y;
29     }
30
31     public void setLocation(cUnit x, cUnit y) {
32         this.x = x;
33         this.y = y;
34     }
35
36     public void setX(cUnit x) {
37         this.x = x;
38     }
39
40     public void setY(cUnit y) {
41         this.y = y;
42     }
43
44     public cUnit getX() {
45         return x;
46     }
47
48     public cUnit getY() {
49         return y;
50     }
51
52     public Point2D.Double JavaDoc getPoint2D() {
53         Point2D.Double JavaDoc temp = new Point2D.Double JavaDoc(x.getPoints(), y.getPoints());
54
55         return temp;
56     }
57
58     public Point JavaDoc getPoint() {
59         Point JavaDoc temp = new Point JavaDoc((int) x.getPoints(), (int) y.getPoints());
60
61         return temp;
62     }
63
64     public cPoint add(cPoint p) {
65         cPoint temp = new cPoint(p.getX().add(getX()), p.getY().add(getY()));
66
67         return temp;
68     }
69
70     public cPoint subHeight(cUnit h) {
71         cPoint temp = new cPoint(getX(), getY().sub(h));
72
73         return temp;
74     }
75
76     public cPoint addHeight(cUnit h) {
77         cPoint temp = new cPoint(getX(), getY().add(h));
78
79         return temp;
80     }
81
82     public Object JavaDoc clone() {
83         cPoint clone = new cPoint(getX(), getY());
84
85         return clone;
86     }
87 }
88
Popular Tags