From 416741f53d64842c90e910d6ad2e7dd03115eb36 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Fri, 24 Apr 2020 21:18:28 +0200 Subject: [PATCH] breadcrumbs: imrpove UI --- ui/BreadCrumbsBar.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ui/BreadCrumbsBar.java b/ui/BreadCrumbsBar.java index 0aea666..ed20f92 100644 --- a/ui/BreadCrumbsBar.java +++ b/ui/BreadCrumbsBar.java @@ -13,7 +13,6 @@ import java.util.List; import javax.swing.AbstractAction; import javax.swing.BoxLayout; -import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JToggleButton; @@ -23,25 +22,28 @@ import javax.swing.event.PopupMenuListener; public class BreadCrumbsBar extends ListenerPanel { private class BreadCrumb extends JPanel { - private JButton button; + private JToggleButton button; private JToggleButton down; public BreadCrumb(final DataNode node) { this.setLayout(new BorderLayout()); - button = new JButton(node.toString()); if (!node.isRoot()) { - // TODO: allow clicking on root? option? + button = new JToggleButton(node.toString()); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - setSelectedNode(node); + button.setSelected(false); + if (!node.isRoot()) { + // TODO: allow clicking on root? option? + setSelectedNode(node); + } } }); + + this.add(button, BorderLayout.CENTER); } - this.add(button, BorderLayout.CENTER); - if (!node.getChildren().isEmpty()) { // TODO (see things with icons included in viewer) down = new JToggleButton(">"); @@ -49,7 +51,6 @@ public class BreadCrumbsBar extends ListenerPanel { for (final DataNode child : node.getChildren()) { popup.add(new AbstractAction(child.toString()) { - private static final long serialVersionUID = 1L; @Override @@ -60,7 +61,6 @@ public class BreadCrumbsBar extends ListenerPanel { } down.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent ev) { if (down.isSelected()) { -- 2.27.0