aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Best Way to Display Icons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Best Way to Display Icons" Watch "Best Way to Display Icons" New topic
Author

Best Way to Display Icons

Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 190

Hi,

I want to display icons much in the same way they are seen displayed in any window of Windows. I am using the following code to fetch the icons.



I just want to know what container is the best to diplay them in a FlowLayout.
Thanks.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

Just add the Icons (not JLabels) to a DefaultListModel and display them in a JList with the layoutOrientation set to HORIZONTAL_WRAP.


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

Joined: Jul 24, 2006
Posts: 190

Ok Darryl,

I will try displaying the icons in a JList as you have suggested.

Thanks for the hint.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

I suggest you don't use ShellFolder; it's in a package that starts with sun, and classes in these packages (along with sunw and com.sun) can change drastically (or even be dropped) between releases.

The good news is that you can use ShellFolder through a class that's in the API - FileSystemView:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 190

Thanks for your reply Bob. I just now got back to this forum and saw that you were the last one to post a comment. I will use what you posted in the place of the shell method. Thanks alot for taking the time to post it and sorry for the late response.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

You're welcome, but it's Rob, not Bob.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best Way to Display Icons