I am using NetBeans and am wanting to use one MouseClick event for 3 JLabels. My issue is that in the Designer when I click on Properties - Events, NetBeans wants to add a custom event handler to my code like this
private void jLabel4MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
}
But all I want is for the Designer to let me use this custom event as my OnClick event for all labels.
public void mousePressed(MouseEvent mEvt) {
JLabel label = (JLabel) mEvt.getSource();
Icon icon = label.getIcon();
//JOptionPane.showMessageDialog(label, icon);
}