From e96619eaf672b7779c7db9bb4db82afa51bd2856 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Wed, 17 Apr 2019 18:46:27 +0200 Subject: [PATCH] GUI: search: show all tag bars --- src/be/nikiroo/fanfix/reader/ui/GuiReaderSearch.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/be/nikiroo/fanfix/reader/ui/GuiReaderSearch.java b/src/be/nikiroo/fanfix/reader/ui/GuiReaderSearch.java index 0046e89..c421ba6 100644 --- a/src/be/nikiroo/fanfix/reader/ui/GuiReaderSearch.java +++ b/src/be/nikiroo/fanfix/reader/ui/GuiReaderSearch.java @@ -48,6 +48,7 @@ public class GuiReaderSearch extends JFrame { private int maxPage; private JPanel tagBars; + private List combos; private JComboBox comboSupportTypes; private JTabbedPane searchTabs; @@ -144,6 +145,8 @@ public class GuiReaderSearch extends JFrame { } private JPanel createByTagSearchPanel() { + combos = new ArrayList(); + JPanel byTag = new JPanel(); tagBars = new JPanel(); tagBars.setLayout(new BoxLayout(tagBars, BoxLayout.Y_AXIS)); @@ -260,6 +263,8 @@ public class GuiReaderSearch extends JFrame { final SearchableTag selected) { tags.add(0, null); + final int comboIndex = combos.size(); + final JComboBox combo = new JComboBox( tags.toArray(new SearchableTag[] {})); combo.setSelectedItem(selected); @@ -298,6 +303,11 @@ public class GuiReaderSearch extends JFrame { final SearchableTag tag = (SearchableTag) combo .getSelectedItem(); if (tag != null) { + while (comboIndex + 1 < combos.size()) { + JComboBox combo = combos.remove(comboIndex + 1); + tagBars.remove(combo); + } + addTagBar(tag, new Runnable() { @Override public void run() { -- 2.27.0