1 19 20 package jxl.format; 21 22 26 public class Alignment 27 { 28 31 private int value; 32 33 36 private String string; 37 38 41 private static Alignment[] alignments = new Alignment[0]; 42 43 49 protected Alignment(int val,String s) 50 { 51 value = val; 52 string = s; 53 54 Alignment[] oldaligns = alignments; 55 alignments = new Alignment[oldaligns.length + 1]; 56 System.arraycopy(oldaligns, 0, alignments, 0, oldaligns.length); 57 alignments[oldaligns.length] = this; 58 } 59 60 66 public int getValue() 67 { 68 return value; 69 } 70 71 76 public String getDescription() 77 { 78 return string; 79 } 80 81 87 public static Alignment getAlignment(int val) 88 { 89 for (int i = 0 ; i < alignments.length ; i++) 90 { 91 if (alignments[i].getValue() == val) 92 { 93 return alignments[i]; 94 } 95 } 96 97 return GENERAL; 98 } 99 100 103 public static Alignment GENERAL = new Alignment(0, "general"); 104 108 public static Alignment LEFT = new Alignment(1, "left"); 109 112 public static Alignment CENTRE = new Alignment(2, "centre"); 113 116 public static Alignment RIGHT = new Alignment(3, "right"); 117 120 public static Alignment FILL = new Alignment(4,"fill"); 121 124 public static Alignment JUSTIFY = new Alignment(5, "justify"); 125 } 126 127 | Popular Tags |