1 7 package javax.swing.plaf.synth; 8 9 46 public class ColorType { 47 50 public static final ColorType FOREGROUND = new ColorType ("Foreground"); 51 52 55 public static final ColorType BACKGROUND = new ColorType ("Background"); 56 57 60 public static final ColorType TEXT_FOREGROUND = new ColorType ( 61 "TextForeground"); 62 63 66 public static final ColorType TEXT_BACKGROUND =new ColorType ( 67 "TextBackground"); 68 69 72 public static final ColorType FOCUS = new ColorType ("Focus"); 73 74 77 public static final int MAX_COUNT; 78 79 private static int nextID; 80 81 private String description; 82 private int index; 83 84 static { 85 MAX_COUNT = Math.max(FOREGROUND.getID(), Math.max( 86 BACKGROUND.getID(), FOCUS.getID())) + 1; 87 } 88 89 94 protected ColorType(String description) { 95 if (description == null) { 96 throw new NullPointerException ( 97 "ColorType must have a valid description"); 98 } 99 this.description = description; 100 synchronized(ColorType .class) { 101 this.index = nextID++; 102 } 103 } 104 105 110 public final int getID() { 111 return index; 112 } 113 114 119 public String toString() { 120 return description; 121 } 122 } 123 | Popular Tags |