Well, my program is nearly finished. I am using JLabel
s with ImageIcon
. But some time when I clicked outside of a JLabel
/ImageIcon
the mouse event is generated un-wantedly on some other label.
I heard that ImageIcon
in JLabel
s are not good for MouseListener
, because even in my program sometime events are wrongly generate when I clicked on one JLabel
ImageIcon
which disabled for mouselistener then an active mouselistener jlabel catch that event and activated.
Please suggest me should I drop the idea for using JLabel
with ImageIcon
and use JButtonp
instead?
Your Suggestions and comments will guide me
Thanks
Conceptually, a label is not intended to be interactive (except tooltips or mouseover effects).
Next you should think of your users. What about those who prefer to use keyboard?
Buttons have a standard (well implemented) behaviour for different mouse events? (Try to click on it and drag the mouse out, for instance)
Go with JButton
and ActionListener
.