1 14 package org.wings; 15 16 import org.wings.plaf.LabelCG; 17 18 27 public class SLabel extends SComponent { 28 29 32 protected String text; 33 34 37 protected SIcon icon = null; 38 39 protected SIcon disabledIcon = null; 40 41 private int verticalTextPosition = SConstants.CENTER; 42 private int horizontalTextPosition = SConstants.RIGHT; 43 private int iconTextGap = 1; 44 private boolean imageAbsBottom = false; 45 46 52 public SLabel(String text) { 53 this(text, null, SConstants.LEFT); 54 } 55 56 59 public SLabel() { 60 this((String ) null); 61 } 62 63 69 public SLabel(SIcon icon) { 70 this(icon, SConstants.LEFT); 71 } 72 73 83 public SLabel(SIcon icon, int horizontalAlignment) { 84 this(null, icon, horizontalAlignment); 85 } 86 87 94 public SLabel(String text, SIcon icon) { 95 this(text, icon, SConstants.LEFT); 96 } 97 98 109 public SLabel(String text, SIcon icon, int horizontalAlignment) { 110 setText(text); 111 setIcon(icon); 112 setHorizontalAlignment(horizontalAlignment); 113 } 114 115 125 public SLabel(String text, int horizontalAlignment) { 126 this(text, null, horizontalAlignment); 127 } 128 129 130 public void setImageAbsBottom(boolean t) { 131 imageAbsBottom = t; 132 } 133 134 135 public boolean isImageAbsBottom() { 136 return imageAbsBottom; 137 } 138 139 146 public int getHorizontalTextPosition() { 147 return horizontalTextPosition; 148 } 149 150 159 public void setHorizontalTextPosition(int textPosition) { 160 horizontalTextPosition = textPosition; 161 } 162 163 172 public void setVerticalTextPosition(int textPosition) { 173 verticalTextPosition = textPosition; 174 } 175 176 183 public int getVerticalTextPosition() { 184 return verticalTextPosition; 185 } 186 187 public void setIconTextGap(int gap) { 188 iconTextGap = gap; 189 } 190 191 public int getIconTextGap() { 192 return iconTextGap; 193 } 194 195 public void setIcon(SIcon i) { 196 reloadIfChange(icon, i); 197 icon = i; 198 } 199 200 public SIcon getIcon() { 201 return icon; 202 } 203 204 public void setDisabledIcon(SIcon i) { 205 reloadIfChange(disabledIcon, i); 206 disabledIcon = i; 207 } 208 209 public SIcon getDisabledIcon() { 210 return disabledIcon; 211 } 212 213 216 public String getText() { 217 return text; 218 } 219 220 226 public void setText(String t) { 227 reloadIfChange(text, t); 228 text = t; 229 } 230 231 public void setCG(LabelCG cg) { 232 super.setCG(cg); 233 } 234 } 235 236 237 | Popular Tags |