home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / java / awt / print / PageFormat.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.9 KB  |  161 lines

  1. package java.awt.print;
  2.  
  3. public class PageFormat implements Cloneable {
  4.    public static final int LANDSCAPE = 0;
  5.    public static final int PORTRAIT = 1;
  6.    public static final int REVERSE_LANDSCAPE = 2;
  7.    private Paper mPaper = new Paper();
  8.    private int mOrientation = 1;
  9.  
  10.    public Object clone() {
  11.       PageFormat var1;
  12.       try {
  13.          var1 = (PageFormat)super.clone();
  14.          var1.mPaper = (Paper)this.mPaper.clone();
  15.       } catch (CloneNotSupportedException var3) {
  16.          ((Throwable)var3).printStackTrace();
  17.          var1 = null;
  18.       }
  19.  
  20.       return var1;
  21.    }
  22.  
  23.    public double getWidth() {
  24.       int var3 = this.getOrientation();
  25.       double var1;
  26.       if (var3 == 1) {
  27.          var1 = this.mPaper.getWidth();
  28.       } else {
  29.          var1 = this.mPaper.getHeight();
  30.       }
  31.  
  32.       return var1;
  33.    }
  34.  
  35.    public double getHeight() {
  36.       int var3 = this.getOrientation();
  37.       double var1;
  38.       if (var3 == 1) {
  39.          var1 = this.mPaper.getHeight();
  40.       } else {
  41.          var1 = this.mPaper.getWidth();
  42.       }
  43.  
  44.       return var1;
  45.    }
  46.  
  47.    public double getImageableX() {
  48.       double var1;
  49.       switch (this.getOrientation()) {
  50.          case 0:
  51.             var1 = this.mPaper.getHeight() - (this.mPaper.getImageableY() + this.mPaper.getImageableHeight());
  52.             break;
  53.          case 1:
  54.             var1 = this.mPaper.getImageableX();
  55.             break;
  56.          case 2:
  57.             var1 = this.mPaper.getImageableY();
  58.             break;
  59.          default:
  60.             throw new InternalError("unrecognized orientation");
  61.       }
  62.  
  63.       return var1;
  64.    }
  65.  
  66.    public double getImageableY() {
  67.       double var1;
  68.       switch (this.getOrientation()) {
  69.          case 0:
  70.             var1 = this.mPaper.getImageableX();
  71.             break;
  72.          case 1:
  73.             var1 = this.mPaper.getImageableY();
  74.             break;
  75.          case 2:
  76.             var1 = this.mPaper.getWidth() - (this.mPaper.getImageableX() + this.mPaper.getImageableWidth());
  77.             break;
  78.          default:
  79.             throw new InternalError("unrecognized orientation");
  80.       }
  81.  
  82.       return var1;
  83.    }
  84.  
  85.    public double getImageableWidth() {
  86.       double var1;
  87.       if (this.getOrientation() == 1) {
  88.          var1 = this.mPaper.getImageableWidth();
  89.       } else {
  90.          var1 = this.mPaper.getImageableHeight();
  91.       }
  92.  
  93.       return var1;
  94.    }
  95.  
  96.    public double getImageableHeight() {
  97.       double var1;
  98.       if (this.getOrientation() == 1) {
  99.          var1 = this.mPaper.getImageableHeight();
  100.       } else {
  101.          var1 = this.mPaper.getImageableWidth();
  102.       }
  103.  
  104.       return var1;
  105.    }
  106.  
  107.    public Paper getPaper() {
  108.       return (Paper)this.mPaper.clone();
  109.    }
  110.  
  111.    public void setPaper(Paper var1) {
  112.       this.mPaper = (Paper)var1.clone();
  113.    }
  114.  
  115.    public void setOrientation(int var1) throws IllegalArgumentException {
  116.       if (0 <= var1 && var1 <= 2) {
  117.          this.mOrientation = var1;
  118.       } else {
  119.          throw new IllegalArgumentException();
  120.       }
  121.    }
  122.  
  123.    public int getOrientation() {
  124.       return this.mOrientation;
  125.    }
  126.  
  127.    public double[] getMatrix() {
  128.       double[] var1 = new double[6];
  129.       switch (this.mOrientation) {
  130.          case 0:
  131.             var1[0] = (double)0.0F;
  132.             var1[1] = (double)-1.0F;
  133.             var1[2] = (double)1.0F;
  134.             var1[3] = (double)0.0F;
  135.             var1[4] = (double)0.0F;
  136.             var1[5] = this.mPaper.getHeight();
  137.             break;
  138.          case 1:
  139.             var1[0] = (double)1.0F;
  140.             var1[1] = (double)0.0F;
  141.             var1[2] = (double)0.0F;
  142.             var1[3] = (double)1.0F;
  143.             var1[4] = (double)0.0F;
  144.             var1[5] = (double)0.0F;
  145.             break;
  146.          case 2:
  147.             var1[0] = (double)0.0F;
  148.             var1[1] = (double)1.0F;
  149.             var1[2] = (double)-1.0F;
  150.             var1[3] = (double)0.0F;
  151.             var1[4] = this.mPaper.getWidth();
  152.             var1[5] = (double)0.0F;
  153.             break;
  154.          default:
  155.             throw new IllegalArgumentException();
  156.       }
  157.  
  158.       return var1;
  159.    }
  160. }
  161.