I ran into a problem when I tried to create an array of all the JLable images. This is what I tried:
Both give me an error saying that there is an "Exception in
thread "main" java.lang.NullPointerException" amd it occurs at there two points in the above code:
I'm not sure what is wrong with the code that would cause it to have a nullPointerException. From my understanding I created a JLabel that represents an image and then I placed that into the array, but it doesn't seem to like that. :/ An explanation as to why would be awesome! Thanks for the help!
I did a little research and found out (at least one way of doing it) that I can use "array[0].setIcon". I'm still running into a problem though where it can't find the file. For some reason it's looking for "Thumbs.db" This is the full error it give me:
java.io.FileNotFoundException: C:\Users\Alex\Desktop\Projects\Planechase_App\Petsche.Alex.Planechase_App\build\classes\petsche\alex\planechase_app\Thumbs.db (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
at java.io.FileOutputStream.<init>(FileOutputStream.java:165)
at org.netbeans.modules.java.source.usages.BuildArtifactMapperImpl.copyFile(BuildArtifactMapperImpl.java:461)
at org.netbeans.modules.java.source.usages.BuildArtifactMapperImpl.copyRecursively(BuildArtifactMapperImpl.java:548)
at org.netbeans.modules.java.source.usages.BuildArtifactMapperImpl.copyRecursively(BuildArtifactMapperImpl.java:541)
at org.netbeans.modules.java.source.usages.BuildArtifactMapperImpl.copyRecursively(BuildArtifactMapperImpl.java:541)
at org.netbeans.modules.java.source.usages.BuildArtifactMapperImpl.copyRecursively(BuildArtifactMapperImpl.java:541)
at org.netbeans.modules.java.source.usages.BuildArtifactMapperImpl.copyRecursively(BuildArtifactMapperImpl.java:541)
at org.netbeans.modules.java.source.usages.BuildArtifactMapperImpl.ensureBuilt(BuildArtifactMapperImpl.java:296)
at org.netbeans.modules.java.source.ant.TranslateClassPath.translateEntry(TranslateClassPath.java:151)
at org.netbeans.modules.java.source.ant.TranslateClassPath.translate(TranslateClassPath.java:113)
at org.netbeans.modules.java.source.ant.TranslateClassPath.execute(TranslateClassPath.java:95)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor146.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:285)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
BUILD FAILED (total time: 0 seconds)
I'm obviously doing something wrong, but I'm not sure what seeing as I've never really used this before. Any help is very much appreciated!