void (@NotNull JComponent component) { component.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(@NotNull MouseEvent e) { setOnHoverForeground(); } @Override public void mouseExited(@NotNull MouseEvent e) { setDefaultForeground(); } }); }