/** * Create a new label element * * @param value the label value * @param minWidth the label minimum width * @throws IllegalArgumentException if the minimum width is negative */ public LabelElement(Object value, int minWidth) throws IllegalArgumentException { if (minWidth < 0) { throw new IllegalArgumentException("No negative min size allowed"); } // String s = String.valueOf(value); // Determine size CharSlicer slicer = new CharSlicer(s); Pair<Integer, Integer> size = slicer.size(); // this.value = s; this.minWidth = Math.min(size.getFirst(), minWidth); this.actualWidth = size.getFirst(); this.actualHeight = size.getSecond(); this.slicer = slicer; }
public LabelElement(String value, int minWidth) { if (minWidth < 0) { throw new IllegalArgumentException("No negative min size allowed"); } // Determine size CharSlicer slicer = new CharSlicer(value); Pair<Integer, Integer> size = slicer.size(); // this.value = value; this.minWidth = Math.min(size.getFirst(), minWidth); this.actualWidth = size.getFirst(); this.actualHeight = size.getSecond(); this.slicer = slicer; }
/** * Create a new label element * * @param value the label value * @param minWidth the label minimum width * @throws IllegalArgumentException if the minimum width is negative */ public LabelElement(Object value, int minWidth) throws IllegalArgumentException { if (minWidth < 0) { throw new IllegalArgumentException("No negative min size allowed"); } // String s = String.valueOf(value); // Determine size CharSlicer slicer = new CharSlicer(s); Pair<Integer, Integer> size = slicer.size(); // this.value = s; this.minWidth = Math.min(size.getFirst(), minWidth); this.actualWidth = size.getFirst(); this.actualHeight = size.getSecond(); this.slicer = slicer; }
/** * Create a new label element * * @param value the label value * @param minWidth the label minimum width * @throws IllegalArgumentException if the minimum width is negative */ public LabelElement(Object value, int minWidth) throws IllegalArgumentException { if (minWidth < 0) { throw new IllegalArgumentException("No negative min size allowed"); } // String s = String.valueOf(value); // Determine size CharSlicer slicer = new CharSlicer(s); Pair<Integer, Integer> size = slicer.size(); // this.value = s; this.minWidth = Math.min(size.getFirst(), minWidth); this.actualWidth = size.getFirst(); this.actualHeight = size.getSecond(); this.slicer = slicer; }