I have imported a few images in my Netbeans Java project. I want to set one of them as a label’s icon when I click a button. I don’t want to use the path of the image in the code.
Please help me.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you have imported images in your project then use :
And enclose it in the actionListener block of that button.
Refer this to know how to use
Jbutton.