コード例 #1
0
 private static int getHeightForFontIncrement(
     IntSetting heightSetting, Component component, int increment) {
   if (increment > 0) {
     return heightSetting.getValue() + 10 * increment + 18 * increment ^ 2;
   }
   return heightSetting.getValue();
 }
コード例 #2
0
 private static int getWidthForFontIncrement(
     IntSetting widthSetting, Component component, int increment) {
   if (increment > 0) {
     return widthSetting.getValue() + 20 * increment + 4 * increment ^ 2;
   }
   return widthSetting.getValue();
 }
コード例 #3
0
 @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());
   }
 }
コード例 #4
0
 @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());
   }
 }
コード例 #5
0
 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));
 }
コード例 #6
0
 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));
 }