aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes show multiple image Using Jlist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "show multiple image Using Jlist" Watch "show multiple image Using Jlist" New topic
Author

show multiple image Using Jlist

ashish donvir
Greenhorn

Joined: Mar 01, 2012
Posts: 25
could any one suggest me the way to show multiple image Using Jlist for example i would like to show thumbnail view of image in a jtabbedpane and on selecting two image they both should open in a other jtabbedoane
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

Welcome to the Ranch.

We have a forum dedicated for Swing questions. I will move this topic over there for you.

You can use a custom renderer for your JList which could be a JPanel instance and then add the image(s) to the panel.
JLabel with an icon would be the easiest way to go.

I do not understand the relation between the JList and JTabbedPane. Could you please rephrase what you are trying to do here?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
ashish donvir
Greenhorn

Joined: Mar 01, 2012
Posts: 25
Maneesh Godbole wrote:Welcome to the Ranch.

We have a forum dedicated for Swing questions. I will move this topic over there for you.

You can use a custom renderer for your JList which could be a JPanel instance and then add the image(s) to the panel.
JLabel with an icon would be the easiest way to go.

I do not understand the relation between the JList and JTabbedPane. Could you please rephrase what you are trying to do here?



i simply need to show multiple images (like thumbnail view of windows) in java and want some event to occur on selecting the image....
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

Recommended reading http://docs.oracle.com/javase/tutorial/uiswing/components/list.html
You can show images as list items (using the renderer I mentioned before) and you can also listen to list selection events
ashish donvir
Greenhorn

Joined: Mar 01, 2012
Posts: 25
Maneesh Godbole wrote:Recommended reading http://docs.oracle.com/javase/tutorial/uiswing/components/list.html
You can show images as list items (using the renderer I mentioned before) and you can also listen to list selection events


well as i am new to java development would you please come with some code and show me how to usw jlist to show image?
thanks
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
if you expect this
"...would you please come with some code and show me..."

then this
"well as i am new to java development"

will never change.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18910
    
    8

Yes. Maneesh provided a link to a tutorial. So instead of reading it, you asked for code instead. How do I know you didn't read it? Because the tutorial includes code which provides examples which would be helpful to you.

Since you're new to Java, you should know that the Oracle tutorials (like the one Maneesh linked to) are the best way to learn about particular topics in Java. So if you want to learn about JList, read the JList tutorial. Download the example code and run it, and then fiddle around with the code. Change it to do something a little different, and then change it to do something a lot different. That's the way to learn Java.
ashish donvir
Greenhorn

Joined: Mar 01, 2012
Posts: 25
Michael Dunn wrote:if you expect this
"...would you please come with some code and show me..."

then this
"well as i am new to java development"

will never change.


Here is my code what i tried. as you can see i had drawn the images in tab name set image. so instead of drawing i actually need to load all images and then allow user to select the image and it should open in other name compare image. suggest me what change i should do in my code to fulfill my requirements? how to generate thumbnail view and allow user to select image

Pierre Sugar
Ranch Hand

Joined: Dec 08, 2002
Posts: 62

You could use a JList as suggest before and use your own list cell renderer for your images. Your renderer could look like this, assuming that your values are ImageIcons.


Pierre
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4658
    
    5

Pierre Sugar wrote:Your renderer could look like this, assuming that your values are ImageIcons.


And the text displayed alongside the Icon would look ... interesting


luck, db
There are no new questions, but there may be new answers.
Pierre Sugar
Ranch Hand

Joined: Dec 08, 2002
Posts: 62

Good point. Just wanted to see if anybody recognises the flaw This probably would help:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: show multiple image Using Jlist