/** * Construct a new dimension with absolute values. * The value is interpreted as absolute pixel values. * * @param width the preferred width in pixel. Use -1 for AUTO. * @param height the preferred height in pixel. Use -1 for AUTO. * @see #setSize(int,int) */ public SDimension(int width, int height) { setSize(width, height); }
/** * Construct a new dimension with absolute values. * The value is interpreted as absolute pixel values. * * @param width the preferred width in pixel. You may pass <code>null</code>. * @param height the preferred height in pixel. You may pass <code>null</code>. * @see #setSize(int,int) */ public SDimension(Integer width, Integer height) { setSize(width != null ? width : AUTO_INT, height != null ? height : AUTO_INT); }
@Override public void setSize(String width, String height) { if (!initialized) { super.setSize(width, height); } else { throw new UnsupportedOperationException(errorMsg); } }
@Override public void setSize(int width, int height) { if (!initialized) { super.setSize(width, height); } else { throw new UnsupportedOperationException(errorMsg); } }
/** * Sets the preferred size of the given component. In case the component's current * dimension is unmodifiable (e.g. FULLAREA, FULLWIDTH, ...) a new dimension object * with the desired initial values is created and set for the component. * * @param component the component which needs to be changed in size * @param width the new width for the given component * @param height the new height for the given component */ public static void setPreferredSize(SComponent component, String width, String height) { try { component.getPreferredSize().setSize(width, height); } catch(UnsupportedOperationException e) { component.setPreferredSize(new SDimension(width, height)); } }
/** * Sets the preferred size of the given component. In case the component's current * dimension is unmodifiable (e.g. FULLAREA, FULLWIDTH, ...) a new dimension object * with the desired initial values is created and set for the component. * * @param component the component which needs to be changed in size * @param width the new width for the given component * @param height the new height for the given component */ public static void setPreferredSize(SComponent component, int width, int height) { try { component.getPreferredSize().setSize(width, height); } catch(UnsupportedOperationException e) { component.setPreferredSize(new SDimension(width, height)); } }