Merge pull request #9008 from Nightfirecat/fix-plugin-list-color-bug

PluginListItem: Reset label color on popup menu item click
This commit is contained in:
Tomas Slusny
2019-07-16 13:06:35 +02:00
committed by GitHub

View File

@@ -317,10 +317,14 @@ class PluginListItem extends JPanel
static void addLabelPopupMenu(final JLabel label, final Collection<JMenuItem> menuItems)
{
final JPopupMenu menu = new JPopupMenu();
final Color labelForeground = label.getForeground();
menu.setBorder(new EmptyBorder(5, 5, 5, 5));
for (final JMenuItem menuItem : menuItems)
{
// Some machines register mouseEntered through a popup menu, and do not register mouseExited when a popup
// menu item is clicked, so reset the label's color when we click one of these options.
menuItem.addActionListener(e -> label.setForeground(labelForeground));
menu.add(menuItem);
}