home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / text / html / CSS$FontWeight.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.2 KB  |  43 lines

  1. package javax.swing.text.html;
  2.  
  3. import javax.swing.text.StyleConstants;
  4. import javax.swing.text.View;
  5.  
  6. class CSS$FontWeight extends CSS.CssValue {
  7.    int weight;
  8.  
  9.    int getValue() {
  10.       return this.weight;
  11.    }
  12.  
  13.    Object parseCssValue(String var1) {
  14.       CSS$FontWeight var2 = new CSS$FontWeight();
  15.       var2.svalue = var1;
  16.       if (var1.equals("bold")) {
  17.          var2.weight = 700;
  18.       } else if (var1.equals("normal")) {
  19.          var2.weight = 400;
  20.       } else {
  21.          try {
  22.             var2.weight = Integer.parseInt(var1);
  23.          } catch (NumberFormatException var4) {
  24.             var2 = null;
  25.          }
  26.       }
  27.  
  28.       return var2;
  29.    }
  30.  
  31.    Object fromStyleConstants(StyleConstants var1, Object var2) {
  32.       return var2.equals(Boolean.TRUE) ? this.parseCssValue("bold") : this.parseCssValue("normal");
  33.    }
  34.  
  35.    Object toStyleConstants(StyleConstants var1, View var2) {
  36.       return this.weight > 500 ? Boolean.TRUE : Boolean.FALSE;
  37.    }
  38.  
  39.    boolean isBold() {
  40.       return this.weight > 500;
  41.    }
  42. }
  43.