Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9115539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:27:25+00:00 2026-06-17T04:27:25+00:00

I have imported a few images in my Netbeans Java project. I want to

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:27:26+00:00Added an answer on June 17, 2026 at 4:27 am

    If you have imported images in your project then use :

    myJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/yourImageName.jpg")));
    

    And enclose it in the actionListener block of that button.

    Refer this to know how to use Jbutton.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have imported a JSF/Facelets project from SVN into Netbeans. Any change which I
So I have imported a project to netbeans. I am using jsf and xhtml
I have a few scss files imported into a larger one using scss's @import
I have two different java projects (I'll call them project 1 and Project 2
I have imported the data into an database. Patient(pt_id,pt_name,pt_type,pt_loc) Now , I want to
I have a a few Flex Builder 3 projects (SDK 3.2/3.5) that I imported
I have a few NT imports I want to use in my program, problem
This is what I've done for a project. I have a few data structures
I have a database backup which I imported into SQL Server and made few
I have a few classes that I want to use in many applications, so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.