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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:04:02+00:00 2026-05-30T20:04:02+00:00

Could anyone suggest to me how to load multiple images in one tab and

  • 0

Could anyone suggest to me how to load multiple images in one tab and after clicking on a particular image it should open in another tab for image processing?

here is the part of my code. here instead if drawing image i actually required to open the load the the images and on selecting particular image it should open to other tab. please suggest me how is it done using jlist or by any other means..

import javax.swing.*;
import java.awt.*;
import java.awt.Event.*;
import java.io.File;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import java.io.IOException;

public class SwindDesign {
public static void main(String[] args) throws IOException {
    JFrame frame = new JFrame("Split Pain");
    frame.setSize(700, 500);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLayout(new GridLayout());

    //panel
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(new PicturePanel());

   JTabbedPane jtp = new JTabbedPane();

     jtp.addTab("Set Image", panel);
      jtp.addTab("Compare Image", new JButton());
      frame.add(jtp);

    }
}
class PicturePanel extends JPanel {

File folder = new File("C:/Documents and Settings/All Users/Documents/My Pictures/Sample Pictures");
File[] listOfFiles = folder.listFiles();
ImageIcon[] img ;
JComponent lblimg;
JTabbedPane jtp = new JTabbedPane();
private BufferedImage[] b = new BufferedImage[10];

public PicturePanel() throws IOException {
    for (int i = 0; i < listOfFiles.length; i++) {
        System.out.println("chek panth"+listOfFiles[i].getName().toString());
        b[i] = ImageIO.read(new File("C:/Documents and Settings/All Users/Documents/My Pictures/Sample Pictures/" + listOfFiles[i].getName().toString()));
    }
}

@Override
protected void paintComponent(Graphics g) {
    super.paintComponents(g);
    Graphics2D g2 = (Graphics2D) g;
    int k = 10;
    for (int j = 0; j < listOfFiles.length - 1; j++) {
        g2.drawImage(b[j], k, 0, 100, 100, null);
        k = k + 75;
        }
    }
}
  • 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-30T20:04:02+00:00Added an answer on May 30, 2026 at 8:04 pm

    could anyone suggest me how to load multiple..

    Use a loop.

    ..images..

    Use ImageIO.read(File/URL/InputStream)

    in on tab..

    Add a JPanel to the tab with a suitable layout, E.G. FlowLayout or GridLayout. Put the image in an undecorated JButton and add it to the panel.

    ..and after clicking on a particular image..

    Add an ActionListener to the button.

    ..it should open inn a other tab for image processing.

    JTabbedPane.addTab("image name", imageEditorComponent)

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

Sidebar

Related Questions

could any one suggest me the way to show multiple images in tab of
Could anyone suggest books or materials to learn unit test? Some people consider codes
Hi Could anyone suggest me efficient of way of getting no of records in
I'm not sure how or why this happened, but if anyone could suggest a
Could anyone suggest a well-documented and well known YAML library for ruby? A book
could anyone suggest a way (other than using Task Manager) to track and log
Could anyone suggest some free/commercial visual editors for JSF. I have tried Visual Web
Could anyone suggest please how I can achieve a substitution cipher style; encrypt and
Could anyone suggest what this error might be caused by and suggest any possible
Can anyone suggest a decent free performance/load testing tool that runs on Windows. I

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.