void (SettingsEditorFragment<?, ?> fragment, JComponent component) { component.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { showHint(fragment, component); } @Override public void mouseExited(MouseEvent e) { showHint(null, component); } }); component.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { showHint(fragment, component); } @Override public void focusLost(FocusEvent e) { showHint(null, component); } }); }