OSDN Git Service

プロファイル作成時にデフォルトのキャラクターデータのダウンロードを問い合わせる
[charactermanaj/CharacterManaJ.git] / src / main / java / charactermanaj / ui / PartsRandomChooserDialog.java
index f513eca..8aab86b 100644 (file)
@@ -47,6 +47,7 @@ import charactermanaj.model.CharacterData;
 import charactermanaj.model.PartsCategory;
 import charactermanaj.model.PartsIdentifier;
 import charactermanaj.model.PartsSet;
+import charactermanaj.ui.util.ScaleSupport;
 import charactermanaj.util.LocalizedResourcePropertyLoader;
 
 /**
@@ -195,6 +196,8 @@ public class PartsRandomChooserDialog extends JDialog {
 
                setTitle(strings.getProperty("partsRandomChooser"));
 
+               ScaleSupport scaleSupport = ScaleSupport.getInstance(this);
+               
                Container contentPane = getContentPane();
                contentPane.setLayout(new BorderLayout());
 
@@ -232,7 +235,8 @@ public class PartsRandomChooserDialog extends JDialog {
                                        int idx = centerPnl.getComponentCount();
                                        RandomChooserPanel pnl = addPartsChooserPanel(centerPnl,
                                                        idx, category, lastInCategory,
-                                                       changePartsIdentifierListener);
+                                                       changePartsIdentifierListener,
+                                                       scaleSupport);
 
                                        // 未選択の場合、もしくは複数選択カテゴリの場合はランダムはディセーブルとする
                                        pnl.setEnableRandom(enable
@@ -290,7 +294,8 @@ public class PartsRandomChooserDialog extends JDialog {
                JButton btnBack = new JButton(actBack);
 
                Box btnPanel = Box.createHorizontalBox();
-               btnPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 42));
+               int mergin = (int)(5 * scaleSupport.getManualScaleX());
+               btnPanel.setBorder(BorderFactory.createEmptyBorder(mergin, mergin, mergin, mergin * 8)); // 5, 5, 5, 40
 
                btnPanel.add(btnRandomAll);
                btnPanel.add(btnBack);
@@ -493,16 +498,18 @@ public class PartsRandomChooserDialog extends JDialog {
                private JToggleButton btnReject;
 
                public RandomChooserPanel(final PartsCategory category,
-                               final boolean lastInCategory) {
+                               final boolean lastInCategory,
+                               final ScaleSupport scaleSupport) {
                        Properties strings = LocalizedResourcePropertyLoader
                                        .getCachedInstance().getLocalizedProperties(
                                                        STRINGS_RESOURCE);
 
+                       int gap = (int)(3 * scaleSupport.getManualScaleX());
                        setBorder(BorderFactory.createCompoundBorder(
-                                       BorderFactory.createEmptyBorder(3, 3, 3, 3),
+                                       BorderFactory.createEmptyBorder(gap, gap, gap, gap),
                                        BorderFactory.createCompoundBorder(
                                                        BorderFactory.createEtchedBorder(),
-                                                       BorderFactory.createEmptyBorder(3, 3, 3, 3))));
+                                                       BorderFactory.createEmptyBorder(gap, gap, gap, gap))));
                        setLayout(new GridBagLayout());
 
                        GridBagConstraints gbc = new GridBagConstraints();
@@ -696,9 +703,10 @@ public class PartsRandomChooserDialog extends JDialog {
                        final int addPos,
                        final PartsCategory category,
                        final boolean lastInCategory,
-                       final ActionListener changePartsIdentifierListener) {
+                       final ActionListener changePartsIdentifierListener,
+                       final ScaleSupport scaleSupport) {
                RandomChooserPanel pnl = new RandomChooserPanel(category,
-                               lastInCategory) {
+                               lastInCategory, scaleSupport) {
                        private static final long serialVersionUID = 1L;
 
                        @Override
@@ -709,7 +717,8 @@ public class PartsRandomChooserDialog extends JDialog {
                                        if (comp.equals(this)) {
                                                // 同じカテゴリのものを追加する
                                                addPartsChooserPanel(centerPnl, idx + 1, category,
-                                                               lastInCategory, changePartsIdentifierListener);
+                                                               lastInCategory, changePartsIdentifierListener,
+                                                               scaleSupport);
                                                centerPnl.validate();
                                                // Addボタンを非表示にする.
                                                ((JButton) e.getSource()).setVisible(false);