I think the location to your image is incorrect.
Where do you store your image and what is the url pattern?
Do you use Matisse builder to add the image to the label or do you do it programmatically?

Netcrystals
 

Von: Dwayne Murphy <dwayne_mur...@wecdsb.on.ca.INVALID>
Gesendet: Freitag, März 10, 2023 4:07 AM
An: users@netbeans.apache.org <users@netbeans.apache.org>
Betreff: Problem adding an image to a label icon...
 
Hi everyone, 

I have a simple project in java / maven  in apache netbeans.

I have a JFrame with a label that I have been trying to add an image to.

I continually get this error when the program tries to add the image to the label:

Cannot invoke "java.net.URL.toExternalForm()" because "location" is null


I have tried using the image selector, as well as custom code options. I have tried all the advice from stack overflow --- and I simply can't figure it out. I must have spent 3-4 hours --- and I'm about to give up.

Can anyone tell me why its so difficult to add an image to a JFrame?  Is there a simple way to do it? Am I missing something?

PS: This link seems to be a great resource for my problems... but I'm still getting the error!


--

Dwayne Murphy  
"Carpe Diem"
Hons B.Computer Science, B. Ed, Hons B.Commerce
Holy Names High School - Science, Business & Civics

Holy Names: 519-966-2504  
Cell Number: 519-995-6915
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org For additional commands, e-mail: users-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to