Method from java.awt.print.PageFormat Detail: |
public Object clone() {
PageFormat newPage;
try {
newPage = (PageFormat) super.clone();
newPage.mPaper = (Paper)mPaper.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
newPage = null; // should never happen.
}
return newPage;
}
Makes a copy of this PageFormat with the same
contents as this PageFormat . |
public double getHeight() {
double height;
int orientation = getOrientation();
if (orientation == PORTRAIT) {
height = mPaper.getHeight();
} else {
height = mPaper.getWidth();
}
return height;
}
Returns the height, in 1/72nds of an inch, of the page.
This method takes into account the orientation of the
page when determining the height. |
public double getImageableHeight() {
double height;
if (getOrientation() == PORTRAIT) {
height = mPaper.getImageableHeight();
} else {
height = mPaper.getImageableWidth();
}
return height;
}
Return the height, in 1/72nds of an inch, of the imageable
area of the page. This method takes into account the orientation
of the page. |
public double getImageableWidth() {
double width;
if (getOrientation() == PORTRAIT) {
width = mPaper.getImageableWidth();
} else {
width = mPaper.getImageableHeight();
}
return width;
}
Returns the width, in 1/72nds of an inch, of the imageable
area of the page. This method takes into account the orientation
of the page. |
public double getImageableX() {
double x;
switch (getOrientation()) {
case LANDSCAPE:
x = mPaper.getHeight()
- (mPaper.getImageableY() + mPaper.getImageableHeight());
break;
case PORTRAIT:
x = mPaper.getImageableX();
break;
case REVERSE_LANDSCAPE:
x = mPaper.getImageableY();
break;
default:
/* This should never happen since it signifies that the
* PageFormat is in an invalid orientation.
*/
throw new InternalError("unrecognized orientation");
}
return x;
}
Returns the x coordinate of the upper left point of the
imageable area of the Paper object
associated with this PageFormat .
This method takes into account the
orientation of the page. |
public double getImageableY() {
double y;
switch (getOrientation()) {
case LANDSCAPE:
y = mPaper.getImageableX();
break;
case PORTRAIT:
y = mPaper.getImageableY();
break;
case REVERSE_LANDSCAPE:
y = mPaper.getWidth()
- (mPaper.getImageableX() + mPaper.getImageableWidth());
break;
default:
/* This should never happen since it signifies that the
* PageFormat is in an invalid orientation.
*/
throw new InternalError("unrecognized orientation");
}
return y;
}
Returns the y coordinate of the upper left point of the
imageable area of the Paper object
associated with this PageFormat .
This method takes into account the
orientation of the page. |
public double[] getMatrix() {
double[] matrix = new double[6];
switch (mOrientation) {
case LANDSCAPE:
matrix[0] = 0; matrix[1] = -1;
matrix[2] = 1; matrix[3] = 0;
matrix[4] = 0; matrix[5] = mPaper.getHeight();
break;
case PORTRAIT:
matrix[0] = 1; matrix[1] = 0;
matrix[2] = 0; matrix[3] = 1;
matrix[4] = 0; matrix[5] = 0;
break;
case REVERSE_LANDSCAPE:
matrix[0] = 0; matrix[1] = 1;
matrix[2] = -1; matrix[3] = 0;
matrix[4] = mPaper.getWidth(); matrix[5] = 0;
break;
default:
throw new IllegalArgumentException();
}
return matrix;
}
Returns a transformation matrix that translates user
space rendering to the requested orientation
of the page. The values are placed into the
array as
{ m00, m10, m01, m11, m02, m12} in
the form required by the AffineTransform
constructor. |
public int getOrientation() {
return mOrientation;
}
Returns the orientation of this PageFormat . |
public Paper getPaper() {
return (Paper)mPaper.clone();
}
Returns a copy of the Paper object associated
with this PageFormat . Changes made to the
Paper object returned from this method do not
affect the Paper object of this
PageFormat . To update the Paper
object of this PageFormat , create a new
Paper object and set it into this
PageFormat by using the #setPaper(Paper)
method. |
public double getWidth() {
double width;
int orientation = getOrientation();
if (orientation == PORTRAIT) {
width = mPaper.getWidth();
} else {
width = mPaper.getHeight();
}
return width;
}
Returns the width, in 1/72nds of an inch, of the page.
This method takes into account the orientation of the
page when determining the width. |
public void setOrientation(int orientation) throws IllegalArgumentException {
if (0 < = orientation && orientation < = REVERSE_LANDSCAPE) {
mOrientation = orientation;
} else {
throw new IllegalArgumentException();
}
}
Sets the page orientation. orientation must be
one of the constants: PORTRAIT, LANDSCAPE,
or REVERSE_LANDSCAPE. |
public void setPaper(Paper paper) {
mPaper = (Paper)paper.clone();
}
Sets the Paper object for this
PageFormat . |