private static int getHeightForFontIncrement( IntSetting heightSetting, Component component, int increment) { if (increment > 0) { return heightSetting.getValue() + 10 * increment + 18 * increment ^ 2; } return heightSetting.getValue(); }
private static int getWidthForFontIncrement( IntSetting widthSetting, Component component, int increment) { if (increment > 0) { return widthSetting.getValue() + 20 * increment + 4 * increment ^ 2; } return widthSetting.getValue(); }
@Override public void componentResized(ComponentEvent e) { Component c = e.getComponent(); if (c.getWidth() != widthSetting.getValue() || c.getHeight() != heightSetting.getValue()) { widthSetting.setValue(c.getWidth()); heightSetting.setValue(c.getHeight()); } }
@Override public void componentResized(ComponentEvent e) { int increment = ThemeSettings.FONT_SIZE_INCREMENT.getValue(); Component c = e.getComponent(); if (c.getWidth() != getWidthForFontIncrement(widthSetting, c, increment) || c.getHeight() != getHeightForFontIncrement(heightSetting, c, increment)) { widthSetting.setValue(c.getWidth()); heightSetting.setValue(c.getHeight()); } }
public static void install(JDialog dialog, IntSetting widthSetting, IntSetting heightSetting) { int increment = ThemeSettings.FONT_SIZE_INCREMENT.getValue(); int width = widthSetting.isDefault() ? getWidthForFontIncrement(widthSetting, dialog, increment) : widthSetting.getValue(); int height = heightSetting.isDefault() ? getHeightForFontIncrement(heightSetting, dialog, increment) : heightSetting.getValue(); dialog.setSize(width, height); dialog.addComponentListener(new SizeChangeListener(widthSetting, heightSetting)); }
public static void install(JDialog dialog, IntSetting widthSetting, IntSetting heightSetting) { int width = widthSetting.getValue(); int height = heightSetting.getValue(); dialog.setSize(width, height); dialog.addComponentListener(new SizeChangeListener(widthSetting, heightSetting)); }