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

  • Home
  • SEARCH
  • 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 4552946
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:52:30+00:00 2026-05-21T16:52:30+00:00

I really need some guidance on how to create a GUI in Java. I’m

  • 0

I really need some guidance on how to create a GUI in Java. I’m a student in college and it’s one of the the thing they never focus on. I currently have the rest of my program set up and working and now I’m trying to make the GUI. I’m creating a new GUI class for this. (I’m under the impression that this is the best practice for this). I kind of understand how to make the basic setup but I don’t understand how to interact with the the GUI afterwards. What I want to do is make a window on startup and then it displays two pictures side by side with a label for each underneath. I want the images to be clickable and when clicked two new images are loaded in their place(labels are changed to underneath). I haven’t done anything like this and I’ve also ran across a lot of different ways to add an image and I’m wondering if there is a best practice.

I can provide code if needed but I didn’t think it would be needed with how my question is posed.

Thanks in advance for all the help.

  • 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-05-21T16:52:31+00:00Added an answer on May 21, 2026 at 4:52 pm

    Some suggestions:

    • Put your images into ImageIcons. Consider having an ArrayList of ImageIcons.
    • Display your ImageIcons in a JLabel. You can change the icon by calling setIcon(…).
    • Display your text in the same JLabel (or if you desire, a different JLabel held beneath the image JLabel both held by a BorderLayout-using JPanel). Change the JLabel text via its setText(…) method.
    • Add a MouseListener to the image-holding JLabel and change the JLabel’s icon in the listener’s mousePressed method. You can get a reference to the label clicked via the mousePressed MouseEvent parameter’s getSource() method.
    • The tutorials mentioned in asgs’s comments will help you with all of this.

    Edit 1:

    • Even better — go with Puce’s recommendation in the comments below my post!
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

guys i really REALLY need some help on this one. 2 days i've been
I really need some help. I have a report of a force close with
I really need some help with a background on a website. You can see
I have never written multi-threaded code before (barring a few basic backgroundworker tricks) and
I have a PHP webservice that returns an XML output, and one of the
I've been looking around for a nice C++ IDE, and I really like the
I've been starting to play around with Node.js recently and I've come across a
I am taking on my first AJAX project and conceptually have everything mapped out
I'm struggling to work out how I should be authoring my partial views which
I apologize in advance if this question is too broad or too it-depends. Basically,

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.