• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

show multiple image Using Jlist

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
ashish donvir
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

 
Ranch Hand
Posts: 62
Ruby Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Pierre Sugar
Ranch Hand
Posts: 62
Ruby Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good point. Just wanted to see if anybody recognises the flaw This probably would help:
 
reply
    Bookmark Topic Watch Topic
  • New Topic