From: Niki Roo Date: Mon, 4 May 2020 08:46:23 +0000 (+0200) Subject: fix Properties panel/frame size X-Git-Tag: fanfix-swing-1.2.0~33 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=51196b298a57a8611dc6bd928fc6f35a1ccf64fa;p=fanfix-swing.git fix Properties panel/frame size --- diff --git a/src/be/nikiroo/fanfix_swing/gui/PropertiesFrame.java b/src/be/nikiroo/fanfix_swing/gui/PropertiesFrame.java index 163b325e..fe67d513 100644 --- a/src/be/nikiroo/fanfix_swing/gui/PropertiesFrame.java +++ b/src/be/nikiroo/fanfix_swing/gui/PropertiesFrame.java @@ -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); diff --git a/src/be/nikiroo/fanfix_swing/gui/PropertiesPanel.java b/src/be/nikiroo/fanfix_swing/gui/PropertiesPanel.java index 496b0733..ecd4cee5 100644 --- a/src/be/nikiroo/fanfix_swing/gui/PropertiesPanel.java +++ b/src/be/nikiroo/fanfix_swing/gui/PropertiesPanel.java @@ -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 listenables; /** @@ -51,6 +52,7 @@ public class PropertiesPanel extends JPanel { boolean includeTitle) { listenables = new ArrayList(); + hscroll = UIManager.getInt("ScrollBar.width"); Color trans = new Color(0, 0, 0, 1); // Image