From: Niki Roo Date: Fri, 24 Apr 2020 19:18:28 +0000 (+0200) Subject: breadcrumbs: imrpove UI X-Git-Tag: fanfix-swing-0.0.2~10 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=3021afa453ab1ace8c510b2a8ffc4d5d1a28525f;p=fanfix-swing.git breadcrumbs: imrpove UI --- diff --git a/src/be/nikiroo/utils/ui/BreadCrumbsBar.java b/src/be/nikiroo/utils/ui/BreadCrumbsBar.java index 0aea666a..ed20f929 100644 --- a/src/be/nikiroo/utils/ui/BreadCrumbsBar.java +++ b/src/be/nikiroo/utils/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()) {