From: Niki Roo Date: Fri, 1 May 2020 14:07:40 +0000 (+0200) Subject: tooltips: more checks X-Git-Tag: fanfix-swing-1.1.0~19 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=16ea1260d3d8a49fe1cd7d1a20e78c0e13628401;p=fanfix-swing.git tooltips: more checks --- diff --git a/src/be/nikiroo/fanfix_swing/gui/BooksPanel.java b/src/be/nikiroo/fanfix_swing/gui/BooksPanel.java index 7842e7d8..def75821 100644 --- a/src/be/nikiroo/fanfix_swing/gui/BooksPanel.java +++ b/src/be/nikiroo/fanfix_swing/gui/BooksPanel.java @@ -250,10 +250,10 @@ public class BooksPanel extends ListenerPanel { @Override public Window generateTooltip(BookInfo book, boolean undecorated) { - if (book != null && book.getMeta() != null) { + MetaData meta = book == null ? null : book.getMeta(); + if (meta != null) { PropertiesFrame tooltip = new PropertiesFrame( - Instance.getInstance().getLibrary(), - book.getMeta()); + Instance.getInstance().getLibrary(), meta); tooltip.setUndecorated(undecorated); return tooltip; } diff --git a/src/be/nikiroo/fanfix_swing/gui/PropertiesFrame.java b/src/be/nikiroo/fanfix_swing/gui/PropertiesFrame.java index 9c00b5e0..634555f4 100644 --- a/src/be/nikiroo/fanfix_swing/gui/PropertiesFrame.java +++ b/src/be/nikiroo/fanfix_swing/gui/PropertiesFrame.java @@ -43,10 +43,12 @@ public class PropertiesFrame extends JDialog { public void setVisible(boolean b) { super.setVisible(b); - int titleBarHeight = Math - .abs(getContentPane().getHeight() - getHeight()); + if (b) { + int titleBarHeight = Math + .abs(getContentPane().getHeight() - getHeight()); - this.setSize(600, desc.getHeight() + titleBarHeight); + this.setSize(600, desc.getHeight() + titleBarHeight); + } } @Override