r/javahelp • u/PawnyExpress • Mar 09 '20
Netbeans is driving me nuts!!
I'm trying to utilize images with my JLabels via the icon property but they fail to load after a few run cycles when I'm double checking things work with other components of my JFrame. I have not altered anything in the code directly correlating to the images or labels either. Anyone know if there's anything I can do to stop this from happening?
2
u/deltageek Extreme Brewer Mar 09 '20
I assume you're using image files with your program, so how are you loading the images into your program? I suspect you have a path problem with how your code is trying to find the files.
1
u/PawnyExpress Mar 09 '20
I made a separate package containing my image files, when I choose the icon property I select the package the images are in and choose image to place on the JLabel which will give me the file.
5
u/joydps Mar 09 '20
I have also faced this problem but in vb.net open file dialog. It's a conflict of the API with your operating system or other software like antivirus installed in your PC
1
u/wildjokers Mar 09 '20
There is almost no information in this post that we can use to help you.
Are you using Netbean's GUI builder?
If you are coding the GUI by hand care to share some code?
Are you loading the images from the file system or class path?
Are you constructing your GUI on the event dispatcher thread (EDT)?
When things work sometimes by not other times in Swing your first though should absolutely be that you are not doing something on the EDT that you should be.
With the information you provided it is hard to even know if you are experiencing an issue with Netbeans or just your java code. Netbeans could be a complete red herring.
Please provide more info.
7
u/[deleted] Mar 09 '20
I highly recommend to checkout intellij idea.The community Edition is free and it is by far the best java ide out there in my opinion.i know this is not a solution for your Problem but i am an experienced java dev and i worked with pretty much every ide out there including netbeans and i can tell this wont be the last time itll drive you crazy.