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 7991755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:22:58+00:00 2026-06-04T13:22:58+00:00

I stumbled upon a problem with my program. What it does: Listens for a

  • 0

I stumbled upon a problem with my program.

What it does: Listens for a row selection in a JTable, uses ‘getSelectedRow’ to fetch the content of a cell, like so:

 public void valueChanged(ListSelectionEvent e) {   

    int row = resultTable.getSelectedRow();
    String val = resultTable.getValueAt(row,2).toString();

    System.out.println("The value of cell 2 at selected row is: " + val);

 }

What is not shown in the above example is that cell 2 of the JTable contains local paths to images, these paths are fetched from a locally run MySQL Database.

What I want it to do: I wish to use the paths contained in cell 2 of my JTable to draw and display the image in an external JFrame whenever valueChanged(displayed above) is triggered.

Taking the above into consideration (and the fact that I’m fairly new at this), how would I go about passing this ‘val’ to an ImageIO.read (that I assume will be running in a seperate class?)

Thank you for your time, any help is appriciated!

  • 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-04T13:23:00+00:00Added an answer on June 4, 2026 at 1:23 pm

    You don’t really need ImageIO for JPEG images. Just add this instead of your System.out.println:

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    JLabel label = new JLabel(new ImageIcon(val));
    frame.setContentPane(label);
    frame.pack();
    frame.setVisible(true); 
    

    If the val parameter contains a valid path, then the image will be displayed.

    If the image is opened more than once, check the value of getValueIsAdjusting() for the ListSelectionEvent

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

Sidebar

Related Questions

We're using Azure CDN, but we've stumbled upon a problem. Before, content could not
I have stumbled upon a problem when creating a program of mine. I have
I stumbled upon a problem of how to make work together acts_as_taggable (on steroids)
I stumbled upon a problem. I'm using a simple AJAX script written in jQuery,
I have recently stumbled upon a problem with selecting relationship details from a 1
I've stumbled upon a problem. I'm using 'FormBorderStyle.None', and when I click the icon
I was writing some commented PHP classes and I stumbled upon a problem. My
Hy, I got an intersting problem which I stumbled upon. When I double-click a
Aside from scalability issues, has anyone here actually stumbled upon a web-development problem where
I have stumbled upon a problem when calling a nested Async which happens to

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.