@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)); }