From: Niki Roo Date: Wed, 17 Apr 2019 16:46:27 +0000 (+0200) Subject: GUI: search: show all tag bars X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=e96619eaf672b7779c7db9bb4db82afa51bd2856;p=fanfix-jexer.git GUI: search: show all tag bars --- 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() {