home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 25 / CDROM25.iso / Share / prog / VJ11 / VJTRIAL.EXE / IE30Java.exe / classd.exe / java / awt / Font.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-27  |  2.7 KB  |  110 lines

  1. package java.awt;
  2.  
  3. public class Font {
  4.    public static final int PLAIN = 0;
  5.    public static final int BOLD = 1;
  6.    public static final int ITALIC = 2;
  7.    private int pData;
  8.    private String family;
  9.    protected String name;
  10.    protected int style;
  11.    protected int size;
  12.  
  13.    public Font(String var1, int var2, int var3) {
  14.       this.family = System.getProperty("awt.font." + var1.toLowerCase(), var1);
  15.       this.name = var1;
  16.       this.style = var2;
  17.       this.size = var3;
  18.    }
  19.  
  20.    public String getFamily() {
  21.       return this.family;
  22.    }
  23.  
  24.    public String getName() {
  25.       return this.name;
  26.    }
  27.  
  28.    public int getStyle() {
  29.       return this.style;
  30.    }
  31.  
  32.    public int getSize() {
  33.       return this.size;
  34.    }
  35.  
  36.    public boolean isPlain() {
  37.       return this.style == 0;
  38.    }
  39.  
  40.    public boolean isBold() {
  41.       return (this.style & 1) != 0;
  42.    }
  43.  
  44.    public boolean isItalic() {
  45.       return (this.style & 2) != 0;
  46.    }
  47.  
  48.    public static Font getFont(String var0) {
  49.       return getFont(var0, (Font)null);
  50.    }
  51.  
  52.    public static Font getFont(String var0, Font var1) {
  53.       String var2 = System.getProperty(var0);
  54.       if (var2 == null) {
  55.          return var1;
  56.       } else {
  57.          String var3 = var2;
  58.          int var4 = 12;
  59.          byte var5 = 0;
  60.          int var6 = var2.indexOf(45);
  61.          if (var6 >= 0) {
  62.             var3 = var2.substring(0, var6);
  63.             var2 = var2.substring(var6 + 1);
  64.             if ((var6 = var2.indexOf(45)) >= 0) {
  65.                if (var2.startsWith("bold-")) {
  66.                   var5 = 1;
  67.                } else if (var2.startsWith("italic-")) {
  68.                   var5 = 2;
  69.                } else if (var2.startsWith("bolditalic-")) {
  70.                   var5 = 3;
  71.                }
  72.  
  73.                var2 = var2.substring(var6 + 1);
  74.             }
  75.  
  76.             try {
  77.                var4 = Integer.valueOf(var2);
  78.             } catch (NumberFormatException var7) {
  79.             }
  80.          }
  81.  
  82.          return new Font(var3, var5, var4);
  83.       }
  84.    }
  85.  
  86.    public int hashCode() {
  87.       return this.name.hashCode() ^ this.style ^ this.size;
  88.    }
  89.  
  90.    public boolean equals(Object var1) {
  91.       if (var1 instanceof Font) {
  92.          Font var2 = (Font)var1;
  93.          return this.size == var2.size && this.style == var2.style && this.name.equals(var2.name);
  94.       } else {
  95.          return false;
  96.       }
  97.    }
  98.  
  99.    public String toString() {
  100.       String var1;
  101.       if (this.isBold()) {
  102.          var1 = this.isItalic() ? "bolditalic" : "bold";
  103.       } else {
  104.          var1 = this.isItalic() ? "italic" : "plain";
  105.       }
  106.  
  107.       return this.getClass().getName() + "[family=" + this.family + ",name=" + this.name + ",style=" + var1 + ",size=" + this.size + "]";
  108.    }
  109. }
  110.