From e91f69802292776152bd392f40249f96b5d91cbd Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sat, 25 Apr 2020 13:04:28 +0200 Subject: [PATCH] fix crumbsbread refresh on display/hide --- .../nikiroo/fanfix_swing/gui/MainFrame.java | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/be/nikiroo/fanfix_swing/gui/MainFrame.java b/src/be/nikiroo/fanfix_swing/gui/MainFrame.java index bc281937..b43b6dda 100644 --- a/src/be/nikiroo/fanfix_swing/gui/MainFrame.java +++ b/src/be/nikiroo/fanfix_swing/gui/MainFrame.java @@ -13,6 +13,7 @@ import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JSplitPane; +import javax.swing.SwingUtilities; import be.nikiroo.fanfix_swing.gui.book.BookInfo; import be.nikiroo.fanfix_swing.gui.importer.ImporterFrame; @@ -29,6 +30,7 @@ public class MainFrame extends JFrame { private ImporterFrame importer = new ImporterFrame(); private List modeItems = new ArrayList(); + private JSplitPane crumbsbreadPane; private boolean sidePanel; private boolean detailsPanel; @@ -76,6 +78,18 @@ public class MainFrame extends JFrame { books.loadData(sources, authors, tags); details.setBook(book); + + if (crumbsbreadPane != null) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + if (crumbsbreadPane != null) { + crumbsbreadPane.revalidate(); + crumbsbreadPane.repaint(); + } + } + }); + } } }); books.addActionListener(new ActionListener() { @@ -219,6 +233,7 @@ public class MainFrame extends JFrame { for (JComponent comp : modeItems) { this.remove(comp); } + crumbsbreadPane = null; modeItems.clear(); if (sidePanel && !detailsPanel) { @@ -237,13 +252,28 @@ public class MainFrame extends JFrame { this.add(split); } else if (!sidePanel && detailsPanel) { goBack.setVertical(true); - JSplitPane other = split(goBack, details, false, 0.5, 1); + JSplitPane other = split(goBack, details, false, 0.5, 0); JSplitPane split = split(other, books, true, 0.5, 0); + crumbsbreadPane = split; modeItems.add(split); this.add(split); } - + this.revalidate(); this.repaint(); + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + browser.revalidate(); + browser.repaint(); + books.revalidate(); + books.repaint(); + details.revalidate(); + details.repaint(); + goBack.revalidate(); + goBack.repaint(); + } + }); } } -- 2.27.0