Add tooltips for navButtons on PluginToolbar

This commit is contained in:
Tyler Hardy
2017-10-15 20:21:43 -05:00
parent 7689a90fd4
commit 9dcc0e0bf4
2 changed files with 10 additions and 0 deletions

View File

@@ -32,13 +32,17 @@ public class NavigationButton
private final JButton button = new JButton(); private final JButton button = new JButton();
private final Supplier<PluginPanel> panelSupplier; private final Supplier<PluginPanel> panelSupplier;
private String name;
public NavigationButton(String name) public NavigationButton(String name)
{ {
this.name = name;
this.panelSupplier = null; this.panelSupplier = null;
} }
public NavigationButton(String name, Supplier<PluginPanel> panelSupplier) public NavigationButton(String name, Supplier<PluginPanel> panelSupplier)
{ {
this.name = name;
this.panelSupplier = panelSupplier; this.panelSupplier = panelSupplier;
} }
@@ -51,4 +55,9 @@ public class NavigationButton
{ {
return panelSupplier; return panelSupplier;
} }
public String getName()
{
return name;
}
} }

View File

@@ -57,6 +57,7 @@ public class PluginToolbar extends JToolBar
public void addNavigation(NavigationButton button) public void addNavigation(NavigationButton button)
{ {
button.getButton().addActionListener((ae) -> onClick(button)); button.getButton().addActionListener((ae) -> onClick(button));
button.getButton().setToolTipText(button.getName());
buttons.add(button); buttons.add(button);
add(button.getButton()); add(button.getButton());