1 19 20 package jxl.format; 21 22 27 public final class ScriptStyle 28 { 29 32 private int value; 33 34 38 private String string; 39 40 43 private static ScriptStyle[] styles = new ScriptStyle[0]; 44 45 46 52 protected ScriptStyle(int val, String s) 53 { 54 value = val; 55 string = s; 56 57 ScriptStyle[] oldstyles = styles; 58 styles = new ScriptStyle[oldstyles.length + 1]; 59 System.arraycopy(oldstyles, 0, styles, 0, oldstyles.length); 60 styles[oldstyles.length] = this; 61 } 62 63 69 public int getValue() 70 { 71 return value; 72 } 73 74 79 public String getDescription() 80 { 81 return string; 82 } 83 84 90 public static ScriptStyle getStyle(int val) 91 { 92 for (int i = 0 ; i < styles.length ; i++) 93 { 94 if (styles[i].getValue() == val) 95 { 96 return styles[i]; 97 } 98 } 99 100 return NORMAL_SCRIPT; 101 } 102 103 public static final ScriptStyle NORMAL_SCRIPT = new ScriptStyle(0, "normal"); 105 public static final ScriptStyle SUPERSCRIPT = new ScriptStyle(1, "super"); 106 public static final ScriptStyle SUBSCRIPT = new ScriptStyle(2, "sub"); 107 108 109 } 110 111 112 113 114 115 116 117 118 119 120 121 | Popular Tags |