![]() |
Complete Java Newbie
I have been having the same issue in a previous tutorial I have been working on every time I try to get my program to look for a png file to display radio buttons I get this below:
Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(Unknown Source) at BT68Gui.<init>(BT68Gui.java:15) at AT68Gui.main(AT68Gui.java:8) I am finding it difficult to progress the way I’d like too if I keep hitting this brick wall any help will be greatly appreciated I am using Eclipse to write my java programs. Eclipse works through c:\users\owner\workspace ;My png files are in workspace. Code:
|
Re: Complete Java Newbie
Give your threads better titles because they look like you are posting the same thing
Complete Java Newbie Complete Java Newbie If all of those thread are same do let me know and I will merge them all. |
Re: New to Java problem code line
Up to now my simple programs work OK! However, every program with this line of code below won't work properly it appears that this line of code can't find my *.png files on my PC any help will be appreciated.
The compiler doesn't find any errors in this line of code. private static String[] filename = {"b.png, x.png"}; private Icon[] pics = {new ImageIcon(getClass().getResource(filename[0])), new ImageIcon(getClass().getResource(filename[1]))}; |
| All times are GMT +5.5. The time now is 02:36. |