1 19 20 package jxl.format; 21 22 25 public class VerticalAlignment 26 { 27 30 private int value; 31 32 35 private String string; 36 37 40 private static VerticalAlignment[] alignments = new VerticalAlignment[0]; 41 42 47 protected VerticalAlignment(int val, String s) 48 { 49 value = val; 50 string = s; 51 52 VerticalAlignment[] oldaligns = alignments; 53 alignments = new VerticalAlignment[oldaligns.length + 1]; 54 System.arraycopy(oldaligns, 0, alignments, 0, oldaligns.length); 55 alignments[oldaligns.length] = this; 56 } 57 58 63 public int getValue() 64 { 65 return value; 66 } 67 68 71 public String getDescription() 72 { 73 return string; 74 } 75 76 82 public static VerticalAlignment getAlignment(int val) 83 { 84 for (int i = 0 ; i < alignments.length ; i++) 85 { 86 if (alignments[i].getValue() == val) 87 { 88 return alignments[i]; 89 } 90 } 91 92 return BOTTOM; 93 } 94 95 96 100 public static VerticalAlignment TOP = new VerticalAlignment(0, "top"); 101 105 public static VerticalAlignment CENTRE = new VerticalAlignment(1, "centre"); 106 110 public static VerticalAlignment BOTTOM = new VerticalAlignment(2, "bottom"); 111 115 public static VerticalAlignment JUSTIFY = new VerticalAlignment(3, "Justify"); 116 } 117 118 | Popular Tags |