1 18 19 package org.objectweb.jac.aspects.gui; 20 21 23 24 public class Border { 25 26 public static final int NONE = 0; 27 28 public static final int LEFT = 1; 29 30 public static final int TOP = 2; 31 32 public static final int RIGHT = 3; 33 34 public static final int BOTTOM = 4; 35 36 public static final int CENTER = 5; 37 38 public static final int LINE = 6; 39 40 public static final int ETCHED = 7; 41 42 public static final int LOWERED = 8; 43 44 public static final int RAISED = 9; 45 46 48 49 public static int a2iAlignment(String alignment) { 50 if (alignment.equals("LEFT")) 51 return LEFT; 52 else if (alignment.equals("RIGHT")) 53 return RIGHT; 54 else if (alignment.equals("CENTER")) 55 return CENTER; 56 else 57 throw new RuntimeException ("Wrong alignment '"+alignment+"'"); 58 } 59 60 62 63 public static int a2iStyle(String style) { 64 if (style.equals("LINE")) 65 return LINE; 66 else if (style.equals("ETCHED")) 67 return ETCHED; 68 else if (style.equals("LOWERED")) 69 return LOWERED; 70 else if (style.equals("RAISED")) 71 return RAISED; 72 else 73 throw new RuntimeException ("Wrong style '"+style+"'"); 74 } 75 76 78 79 public static String i2aStyle(int style) { 80 if (style==LINE) 81 return "LINE"; 82 else if (style==ETCHED) 83 return "ETCHED"; 84 else if (style==LOWERED) 85 return "LOWERED"; 86 else if (style==RAISED) 87 return "RAISED"; 88 else 89 throw new RuntimeException ("Wrong style '"+style+"'"); 90 } 91 92 98 99 public Border(String title,int alignment,int style) { 100 this.title = title; 101 this.alignment = alignment; 102 this.style = style; 103 } 104 105 107 public boolean hasTitle() { 108 return title!=null; 109 } 110 111 int alignment; 112 113 117 public int getAlignment() { 118 return alignment; 119 } 120 121 125 public void setAlignment(int v) { 126 this.alignment = v; 127 } 128 129 int style; 130 131 135 public int getStyle() { 136 return style; 137 } 138 139 143 public void setStyle(int v) { 144 this.style = v; 145 } 146 147 String title; 148 149 153 public String getTitle() { 154 return title; 155 } 156 157 161 public void setTitle(String v) { 162 this.title = v; 163 } 164 165 public String toString() { 166 return "Border{title="+title+",style="+style+"}"; 167 } 168 } 169 | Popular Tags |