java - JLabel MouseEvent not excecuting after compiling my program to a jar -
i working on program. in 1 of panels there jlabel
, can click , dialog open. far good, if compile program jar , run it, label unclickable , of events ignored, no exceptions, nothing.
in ide, label , events fine , components work properly. problem is: don't know how fix this.
i don't know if should post code, think not code causes bug. ideas?
here abstract form of code:
public class tasklistpanel extends javax.swing.jpanel { private javax.swing.jlabel lbladdtask; /** * creates new form tasklistpanel */ public tasklistpanel() { initcomponents(); } private void initcomponents() { lbladdtask.seticon(new javax.swing.imageicon(getclass().getresource("/path/to/my/icon.png"))); // noi18n lbladdtask.addmouselistener(new java.awt.event.mouseadapter() { public void mouseclicked(java.awt.event.mouseevent evt) { lbladdtaskmouseclicked(evt); } public void mouseentered(java.awt.event.mouseevent evt) { lbladdtaskmouseentered(evt); } public void mouseexited(java.awt.event.mouseevent evt) { lbladdtaskmouseexited(evt); } }); } //some more methods private void lbladdtaskmouseentered(java.awt.event.mouseevent evt) { lbladdtask.seticon(new imageicon(getclass().getresource("/path/to/my/iconhighlighted.png/"))); } private void lbladdtaskmouseexited(java.awt.event.mouseevent evt) { lbladdtask.seticon(new imageicon(getclass().getresource("/path/to/my/icon.png/"))); } private void lbladdtaskmouseclicked(java.awt.event.mouseevent evt) { //mydifferentdialog custom dialog, works fine. mydifferentdialog dialog = new mydifferentdialog(); } }
none of lbladdtask events activiated. maybe problem in ide (netbeans) causes bug because compiles programm wrong jar?
okay bug caused imageicon statement:
lbladdtask.seticon(new imageicon(getclass().getresource("/path/to/my/iconhighlighted.png/")));
thanks mkorble suggestion.
Comments
Post a Comment