From d952ffd8567c2818ffe19d9eea965c7f7c4edacc Mon Sep 17 00:00:00 2001 From: ericek111 Date: Wed, 19 Aug 2026 20:11:40 +0000 Subject: [PATCH] Put each client limit's count beside its "Limited" choice The counts sat on a line of their own below the choices they belong to, which also made the Advanced tab the tallest of the four and so decided how much of the dialog the tab strip took. Each box now keeps its natural height, and the free space collects below them. Advanced went from 250px to 220px of preferred height, leaving the tab strip about a third of the dialog rather than half. Co-Authored-By: Claude Opus 5 --- .../ts3client/ui/ChannelAdvancedPanel.java | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/ts3-client/swing/src/main/java/com/ts3client/ui/ChannelAdvancedPanel.java b/ts3-client/swing/src/main/java/com/ts3client/ui/ChannelAdvancedPanel.java index 11e549a..5084af6 100644 --- a/ts3-client/swing/src/main/java/com/ts3client/ui/ChannelAdvancedPanel.java +++ b/ts3-client/swing/src/main/java/com/ts3client/ui/ChannelAdvancedPanel.java @@ -14,6 +14,7 @@ import javax.swing.JRadioButton; import javax.swing.JSpinner; import javax.swing.JTextField; import javax.swing.SpinnerNumberModel; +import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -76,6 +77,7 @@ final class ChannelAdvancedPanel extends JPanel implements ChannelDialog.Tab { JPanel other = otherSettings(); other.setAlignmentX(0f); + fixHeight(other); add(other); add(Box.createVerticalStrut(6)); @@ -86,6 +88,7 @@ final class ChannelAdvancedPanel extends JPanel implements ChannelDialog.Tab { limits.add(limitBox("Family Max Users", new JRadioButton[]{familyInherited, familyUnlimited, familyLimited}, familyMaxUsers)); limits.setAlignmentX(0f); + fixHeight(limits); add(limits); add(Box.createVerticalGlue()); } @@ -162,26 +165,36 @@ final class ChannelAdvancedPanel extends JPanel implements ChannelDialog.Tab { c.gridx = 1; c.gridy = 2; panel.add(encrypted, c); - - c.gridx = 0; - c.gridy = 3; - c.weighty = 1; - panel.add(Box.createGlue(), c); return panel; } + /** + * A limit box: its choices stacked, with the count beside the last of them — + * "Limited", the only choice it belongs to. + */ private JPanel limitBox(String title, JRadioButton[] choices, JSpinner spinner) { JPanel box = new JPanel(); box.setLayout(new BoxLayout(box, BoxLayout.Y_AXIS)); box.setBorder(BorderFactory.createTitledBorder(title)); - for (JRadioButton radio : choices) { + for (int i = 0; i < choices.length; i++) { + JRadioButton radio = choices[i]; radio.setAlignmentX(0f); - box.add(radio); + if (i < choices.length - 1) { + box.add(radio); + continue; + } + JPanel row = new JPanel(new FlowLayout(FlowLayout.LEFT, 6, 0)); + row.setAlignmentX(0f); + row.add(radio); + row.add(spinner); + box.add(row); } - spinner.setAlignmentX(0f); - box.add(Box.createVerticalStrut(4)); - box.add(spinner); box.add(Box.createVerticalGlue()); return box; } + + /** Keeps a section at its natural height, so the free space collects at the bottom. */ + private static void fixHeight(JPanel panel) { + panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, panel.getPreferredSize().height)); + } }