Here is the current example:
ImageIcon backArrowIcon = new ImageIcon("agt_back-64.png"); jBackButton.setIcon(backArrowIcon);
I have also tried:
This one gives me a null pointer exception.
"agt_back-64.png" is in the same package/folder as this class. I have tried putting it in its own image folder. I have changed "agt_back-64.png" to include some or all of its directories. I have even opened a form editor in eclipse and tried to invoke the setIcon() from the form editor using its file chooser, but no luck.
The thing is, I tried this in NetBeans earlier today and it worked perfectly. I even copy and pasted the exact line of code I used in NetBeans and replaced the file directory, but I still get a null pointer. Does anyone have any possible solutions or diagnosis?
Or maybe someone has an alternative way to import images into Eclipse or something?
Here's the exception I'm getting if it helps:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(Unknown Source) at s.Clone.getJButton8(Clone.java:1639) at s.Clone.getJPanel8(Clone.java:1609) at s.Clone.getJDialog3(Clone.java:1597) at s.Clone.<init>(Clone.java:1231) at s.Clone$5.run(Clone.java:1251) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown Source) at java.awt.EventQueue$1.run(Unknown Source) at java.awt.EventQueue$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)