/** * Creates and returns a ConstantSize * for the specified pixel value. * * @param value value in pixel * @return the associated {@code ConstantSize} */ public static ConstantSize pixel(int value) { return new ConstantSize(value, ConstantSize.PIXEL); }
/** * Creates and returns a ConstantSize for the specified size value * in vertical dialog units. * * @param value size value in vertical dialog units * @return the associated Size instance */ static ConstantSize dluY(int value) { return new ConstantSize(value, DLUY); }
/** * Returns an instance of <code>Size</code> for the specified value in * horizontal dialog units. * * @param value * size value in horizontal dialog units * @return the associated Size instance */ static ConstantSize dluX(int value) { return new ConstantSize(value, DLUX); }
/** * Creates and returns a ConstantSize for the specified size value * in horizontal dialog units. * * @param value size value in horizontal dialog units * @return the associated Size instance */ static ConstantSize dluX(int value) { return new ConstantSize(value, DLUX); }
/** * Creates and returns an instance of <code>Size</code> for the specified * pixel value. * * @param value * value in pixel * @return the associated <code>ConstantSize</code> */ public static ConstantSize pixel(int value) { return new ConstantSize(value, ConstantSize.PIXEL); }
/** * Creates and returns a ConstantSize for the specified size value * in vertical dialog units. * * @param value size value in vertical dialog units * @return the associated Size instance */ static ConstantSize dluY(int value) { return new ConstantSize(value, DLUY); }
/** * Creates and returns a ConstantSize * for the specified pixel value. * * @param value value in pixel * @return the associated <code>ConstantSize</code> */ public static ConstantSize pixel(int value) { return new ConstantSize(value, ConstantSize.PIXEL); }
/** * Creates and returns a ConstantSize for the specified size value * in horizontal dialog units. * * @param value size value in horizontal dialog units * @return the associated Size instance */ static ConstantSize dluX(int value) { return new ConstantSize(value, DLUX); }
/** * Returns an instance of <code>Size</code> for the specified value in * vertical dialog units. * * @param value * size value in vertical dialog units * @return the associated Size instance */ static ConstantSize dluY(int value) { return new ConstantSize(value, DLUY); }
/** * Creates and returns a ConstantSize from the given encoded size * and unit description. * * @param encodedValueAndUnit the size's value and unit as string, * trimmed and in lower case * @param horizontal true for horizontal, false for vertical * @return a constant size for the given encoding and unit description * * @throws IllegalArgumentException if the unit requires integer * but the value is not an integer */ static ConstantSize valueOf(String encodedValueAndUnit, boolean horizontal) { String[] split = ConstantSize.splitValueAndUnit(encodedValueAndUnit); String encodedValue = split[0]; String encodedUnit = split[1]; Unit unit = Unit.valueOf(encodedUnit, horizontal); double value = Double.parseDouble(encodedValue); if (unit.requiresIntegers) { if (value != (int) value) throw new IllegalArgumentException(unit.toString() + " value " + encodedValue + " must be an integer."); } return new ConstantSize(value, unit); }
/** * Constructs an instance of <code>ConstantSize</code> from the given * encoded size and unit description. * * @param encodedValueAndUnit * the size's value and unit as string * @param horizontal * true for horizontal, false for vertical * @return a constant size for the given encoding and unit description * @throws IllegalArgumentException * if the unit requires integer but the value is not an integer */ static ConstantSize valueOf(String encodedValueAndUnit, boolean horizontal) { String split[] = ConstantSize.splitValueAndUnit(encodedValueAndUnit); String encodedValue = split[0]; String encodedUnit = split[1]; Unit unit = Unit.valueOf(encodedUnit, horizontal); double value = Double.parseDouble(encodedValue); if (unit.requiresIntegers) { if (value != (int) value) throw new IllegalArgumentException(unit.toString() + " value " + encodedValue + " must be an integer."); } return new ConstantSize(value, unit); }
/** * Creates and returns a ConstantSize from the given encoded size * and unit description. * * @param encodedValueAndUnit the size's value and unit as string, * trimmed and in lower case * @param horizontal true for horizontal, false for vertical * @return a constant size for the given encoding and unit description * * @throws IllegalArgumentException if the unit requires integer * but the value is not an integer */ static ConstantSize valueOf(String encodedValueAndUnit, boolean horizontal) { String[] split = ConstantSize.splitValueAndUnit(encodedValueAndUnit); String encodedValue = split[0]; String encodedUnit = split[1]; Unit unit = Unit.valueOf(encodedUnit, horizontal); double value = Double.parseDouble(encodedValue); if (unit.requiresIntegers) { checkArgument(value == (int) value, "%s value %s must be an integer.", unit, encodedValue); } return new ConstantSize(value, unit); }