Example #1
0
 /**
  * Sets the scaled component height, adopting the original component width.
  *
  * @param comp component
  * @param h height
  */
 public static void setHeight(final Component comp, final int h) {
   comp.setPreferredSize(new Dimension(comp.getPreferredSize().width, (int) (h * scale)));
 }
Example #2
0
 /**
  * Sets the scaled component width, adopting the original component height.
  *
  * @param comp component
  * @param w width
  */
 public static void setWidth(final Component comp, final int w) {
   comp.setPreferredSize(new Dimension((int) (w * scale), comp.getPreferredSize().height));
 }