Java Disabled JLabel Reports Mouse Clicked
Posted
by ikurtz
on Stack Overflow
See other posts from Stack Overflow
or by ikurtz
Published on 2010-04-19T18:50:01Z
Indexed on
2010/04/19
18:53 UTC
Read the original article
Hit count: 201
colLabels[i].addMouseListener(new MyAdapter());
private class MyAdapter extends MouseAdapter {
@Override
public void mouseClicked(MouseEvent event) {
ColJLabel colJLabel = (ColJLabel)event.getComponent();
System.out.println(colJLabel.ColID);
setColumnHeader(false);
}
}
colLabels[i].setEnabled(flag);
The situation is this: Mouse clicks are trapped correctly but when i have the JLabel (ColJLabel) control disabled it still reports mouse clicks.
How can I make so that mouse clicks are only reported when the control is enabled?
Thanks.
© Stack Overflow or respective owner