fix Properties panel/frame size
authorNiki Roo <niki@nikiroo.be>
Mon, 4 May 2020 08:46:23 +0000 (10:46 +0200)
committerNiki Roo <niki@nikiroo.be>
Mon, 4 May 2020 08:46:23 +0000 (10:46 +0200)
src/be/nikiroo/fanfix_swing/gui/PropertiesFrame.java
src/be/nikiroo/fanfix_swing/gui/PropertiesPanel.java

index 163b325eea9cd31b525f9bb26b53da9782288132..fe67d513d41383c1d6ed9d9d70a7bf7db922109d 100644 (file)
@@ -41,25 +41,16 @@ public class PropertiesFrame extends JDialog {
                setLayout(new BorderLayout());
                add(desc, BorderLayout.NORTH);
 
-               this.setSize(600, desc.getHeight() + 0);
                this.setUndecorated(undecorated);
 
+               pack();
+               this.setSize(600, getHeight());
+
                if (!undecorated) {
                        UiHelper.setFrameIcon(this, lib, meta);
                }
        }
 
-       @Override
-       public void setVisible(final boolean b) {
-               super.setVisible(b);
-
-               if (b) {
-                       int titleBarHeight = Math
-                                       .abs(getContentPane().getHeight() - getHeight());
-                       this.setSize(600, desc.getHeight() + titleBarHeight);
-               }
-       }
-
        @Override
        public synchronized void addMouseListener(MouseListener l) {
                super.addMouseListener(l);
index 496b0733f77a3cec87d7666bd683a212a93f11c9..ecd4cee50003aa88bfab181387f1ca0510b10c6a 100644 (file)
@@ -15,6 +15,7 @@ import javax.swing.ImageIcon;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JTextArea;
+import javax.swing.UIManager;
 import javax.swing.border.EmptyBorder;
 
 import be.nikiroo.fanfix.data.MetaData;
@@ -33,8 +34,8 @@ import be.nikiroo.utils.ui.UIUtils;
 public class PropertiesPanel extends JPanel {
        private static final long serialVersionUID = 1L;
        private final int space = 10; // empty space for visual correctness
-       private final int hscroll = 10; // we reserve space at the bottom for a
-                                                                       // potential HScroll
+       private final int hscroll; // we reserve space at the bottom for a
+                                                               // potential HScroll
        private List<Component> listenables;
 
        /**
@@ -51,6 +52,7 @@ public class PropertiesPanel extends JPanel {
                        boolean includeTitle) {
                listenables = new ArrayList<Component>();
 
+               hscroll = UIManager.getInt("ScrollBar.width");
                Color trans = new Color(0, 0, 0, 1);
 
                // Image