source: trunk/gcc/libjava/java/awt/print/Paper.java

Last change on this file was 1389, checked in by bird, 21 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 6.1 KB
Line 
1/* Paper.java -- Information about a paper type.
2 Copyright (C) 1999 Free Software Foundation, Inc.
3
4This file is part of GNU Classpath.
5
6GNU Classpath is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU Classpath is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Classpath; see the file COPYING. If not, write to the
18Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1902111-1307 USA.
20
21Linking this library statically or dynamically with other modules is
22making a combined work based on this library. Thus, the terms and
23conditions of the GNU General Public License cover the whole
24combination.
25
26As a special exception, the copyright holders of this library give you
27permission to link this library with independent modules to produce an
28executable, regardless of the license terms of these independent
29modules, and to copy and distribute the resulting executable under
30terms of your choice, provided that you also meet, for each linked
31independent module, the terms and conditions of the license of that
32module. An independent module is a module which is not derived from
33or based on this library. If you modify this library, you may extend
34this exception to your version of the library, but you are not
35obligated to do so. If you do not wish to do so, delete this
36exception statement from your version. */
37
38
39package java.awt.print;
40
41/**
42 * This class describes a particular type of paper.
43 *
44 * @author Aaron M. Renn (arenn@urbanophile.com)
45 */
46public class Paper
47{
48
49/*
50 * Instance Variables
51 */
52
53// Height of the paper
54private double height;
55
56// Width of the paper
57private double width;
58
59// Upper left imageable X coordinate
60private double imageableX;
61
62// Upper left imageable Y coordinate
63private double imageableY;
64
65// Imageable width of the page
66private double imageableWidth;
67
68// Imageable height of the page
69private double imageableHeight;
70
71/*************************************************************************/
72
73/*
74 * Constructor
75 */
76
77/**
78 * This method creates a letter sized paper with one inch margins
79 */
80public
81Paper()
82{
83 width = 8.5 * 72;
84 height = 11 * 72;
85 imageableX = 72;
86 imageableY = 72;
87 imageableWidth = width - (2 * 72);
88 imageableHeight = height - (2 * 72);
89}
90
91/*************************************************************************/
92
93/**
94 * This method returns the height of the paper in 1/72nds of an inch.
95 *
96 * @return The height of the paper in 1/72nds of an inch.
97 */
98public double
99getHeight()
100{
101 return(height);
102}
103
104/*************************************************************************/
105
106/**
107 * Returns the width of the paper in 1/72nds of an inch.
108 *
109 * @return The width of the paper in 1/72nds of an inch.
110 */
111public double
112getWidth()
113{
114 return(width);
115}
116
117/*************************************************************************/
118
119/**
120 * This method returns the X coordinate of the upper left hand corner
121 * of the imageable area of the paper.
122 *
123 * @return The X coordinate of the upper left hand corner of the imageable
124 * area of the paper.
125 */
126public double
127getImageableX()
128{
129 return(imageableX);
130}
131
132/*************************************************************************/
133
134/**
135 * This method returns the Y coordinate of the upper left hand corner
136 * of the imageable area of the paper.
137 *
138 * @return The Y coordinate of the upper left hand corner of the imageable
139 * area of the paper.
140 */
141public double
142getImageableY()
143{
144 return(imageableY);
145}
146
147/*************************************************************************/
148
149/**
150 * Returns the width of the imageable area of the paper.
151 *
152 * @return The width of the imageable area of the paper.
153 */
154public double
155getImageableWidth()
156{
157 return(imageableWidth);
158}
159
160/*************************************************************************/
161
162/**
163 * Returns the height of the imageable area of the paper.
164 *
165 * @return The height of the imageable area of the paper.
166 */
167public double
168getImageableHeight()
169{
170 return(imageableHeight);
171}
172
173/*************************************************************************/
174
175/**
176 * This method sets the size of the paper to the specified width and
177 * height, which are specified in 1/72nds of an inch.
178 *
179 * @param width The width of the paper in 1/72nds of an inch.
180 * @param height The height of the paper in 1/72nds of an inch.
181 */
182public void
183setSize(double width, double height)
184{
185 this.width = width;
186 this.height = height;
187}
188
189/*************************************************************************/
190
191/**
192 * This method sets the imageable area of the paper by specifying the
193 * coordinates of the upper left hand corner of that area, and its
194 * length and height. All values are in 1/72nds of an inch.
195 *
196 * @param imageableX The X coordinate of the upper left hand corner of
197 * the imageable area, in 1/72nds of an inch.
198 * @param imageableY The Y coordinate of the upper left hand corner of
199 * the imageable area, in 1/72nds of an inch.
200 * @param imageableWidth The width of the imageable area of the paper,
201 * in 1/72nds of an inch.
202 * @param imageableHeight The heigth of the imageable area of the paper,
203 * in 1/72nds of an inch.
204 */
205public void
206setImageableArea(double imageableX, double imageableY,
207 double imageableWidth, double imageableHeight)
208{
209 this.imageableX = imageableX;
210 this.imageableY = imageableY;
211 this.imageableWidth = imageableWidth;
212 this.imageableHeight = imageableHeight;
213}
214
215/*************************************************************************/
216
217/**
218 * This method creates a copy of this object.
219 *
220 * @return A copy of this object.
221 */
222public Object
223clone()
224{
225 try
226 {
227 return(super.clone());
228 }
229 catch(CloneNotSupportedException e)
230 {
231 return(null);
232 }
233}
234
235} // class Paper
236
Note: See TracBrowser for help on using the repository browser.