I want to highlight some elements on screen, when one JMenuItem in PopupMenu ist selected(mouse over). So i use MouseListener on my JMenuItem with
@Override
public void mouseEntered(MouseEvent e) {
highlightOn();
}
@Override
public void mouseExited(MouseEvent e) {
highlightOff();
}
It works fine, but if i press Esc the popup menu will be closed, without clean the highligt. How can i intercept the closing of JPopupMenu to handle this?
you look at
PopupMenuListener
better could be
JMenuItem
(s) can returns ButtonModel
,
ButtonModel
returns isRollover()
, isArmend()
, isPressed()
e.i.
each of JButtons JComponents
(JButton, JCheckBox, JRadioButton and JMenuXxx) implemented diferrent methods from ButtonModel