public static Dimension getScaledDimension(int width, int height) { if (FontUtils.getScale() == 1) { // dont need to scale return new Dimension(width, height); } return new Dimension( (int) (width * FontUtils.getScale()), (int) (height * FontUtils.getScale())); }
public static ImageIcon getScaledIcon(ImageIcon icon) { if (!isScaleImages() || icon == null || FontUtils.getScale() == 1 || icon.getIconHeight() > STD_HEIGHT) { // dont need to scale return icon; } return new ImageIcon( ((ImageIcon) icon) .getImage() .getScaledInstance( (int) (icon.getIconWidth() * FontUtils.getScale()), (int) (icon.getIconHeight() * FontUtils.getScale()), Image.SCALE_SMOOTH)); }
public static Icon getScaledIcon(Icon icon) { if (!isScaleImages() || icon == null || FontUtils.getScale() == 1 || !(icon instanceof ImageIcon)) { // dont need to scale (or cant) return icon; } return getScaledIcon((ImageIcon) icon); }
public static int getScaledSize(int size) { return (int) (size * FontUtils.getScale()); }