git://git.nikiroo.be
/
fanfix.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fde375c
)
ConfigItem: assure label placement if taller pane
author
Niki Roo
<niki@nikiroo.be>
Thu, 23 May 2019 07:51:07 +0000
(09:51 +0200)
committer
Niki Roo
<niki@nikiroo.be>
Thu, 23 May 2019 07:51:07 +0000
(09:51 +0200)
src/be/nikiroo/utils/ui/ConfigItem.java
patch
|
blob
|
blame
|
history
diff --git
a/src/be/nikiroo/utils/ui/ConfigItem.java
b/src/be/nikiroo/utils/ui/ConfigItem.java
index 14348b6dd4c1ceab382fdb6e634013e6592bb1fa..46333701ef67a7101935d45a629180dcd61c7c34 100644
(file)
--- a/
src/be/nikiroo/utils/ui/ConfigItem.java
+++ b/
src/be/nikiroo/utils/ui/ConfigItem.java
@@
-51,6
+51,8
@@
import be.nikiroo.utils.resources.MetaInfo;
public class ConfigItem<E extends Enum<E>> extends JPanel {
private static final long serialVersionUID = 1L;
public class ConfigItem<E extends Enum<E>> extends JPanel {
private static final long serialVersionUID = 1L;
+ private static int minimumHeight = -1;
+
/** A small (?) blue in PNG, base64 encoded. */
private static String infoImage64 = //
""
/** A small (?) blue in PNG, base64 encoded. */
private static String infoImage64 = //
""
@@
-444,6
+446,8
@@
public class ConfigItem<E extends Enum<E>> extends JPanel {
ps = label.getSize();
}
ps = label.getSize();
}
+ ps.height = Math.max(ps.height, getMinimumHeight());
+
int w = ps.width;
int step = 150;
for (int i = 2 * step - nhgap; i < 10 * step; i += step) {
int w = ps.width;
int step = 150;
for (int i = 2 * step - nhgap; i < 10 * step; i += step) {
@@
-498,13
+502,16
@@
public class ConfigItem<E extends Enum<E>> extends JPanel {
pane2.add(help, BorderLayout.WEST);
pane2.add(new JLabel(" "), BorderLayout.CENTER);
pane2.add(help, BorderLayout.WEST);
pane2.add(new JLabel(" "), BorderLayout.CENTER);
- JPanel
p
ane = new JPanel(new BorderLayout());
-
p
ane.add(label, BorderLayout.WEST);
-
p
ane.add(pane2, BorderLayout.CENTER);
+ JPanel
contentP
ane = new JPanel(new BorderLayout());
+
contentP
ane.add(label, BorderLayout.WEST);
+
contentP
ane.add(pane2, BorderLayout.CENTER);
ps.width = w + 30; // 30 for the (?) sign
ps.width = w + 30; // 30 for the (?) sign
- pane.setSize(ps);
- pane.setPreferredSize(ps);
+ contentPane.setSize(ps);
+ contentPane.setPreferredSize(ps);
+
+ JPanel pane = new JPanel(new BorderLayout());
+ pane.add(contentPane, BorderLayout.NORTH);
return pane;
}
return pane;
}
@@
-548,9
+555,16
@@
public class ConfigItem<E extends Enum<E>> extends JPanel {
}
private void setPreferredSize(JComponent field) {
}
private void setPreferredSize(JComponent field) {
- JTextField a = new JTextField("Test");
- int height = Math.max(a.getMinimumSize().height,
- field.getMinimumSize().height);
+ int height = Math
+ .max(getMinimumHeight(), field.getMinimumSize().height);
setPreferredSize(new Dimension(200, height));
}
setPreferredSize(new Dimension(200, height));
}
+
+ static private int getMinimumHeight() {
+ if (minimumHeight < 0) {
+ minimumHeight = new JTextField("Test").getMinimumSize().height;
+ }
+
+ return minimumHeight;
+ }
}
}