File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Retrieve system icons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Retrieve system icons" Watch "Retrieve system icons" New topic
Author

Retrieve system icons

Davide Zanotti
Greenhorn

Joined: May 05, 2007
Posts: 7
Is there a way to retrieve the system's icons? (for example the folder icon)
rohit leeta
Ranch Hand

Joined: May 02, 2007
Posts: 49
No, you cant. You need find/extract those icons and use from your java program by specifying their paths. Actually i dont think those icons will look good in a java application. Try searching "Java look and feel guidlines", there are a couple of Java-compatible icons there.


<a href="http://www.java-forums.org" target="_blank" rel="nofollow">Java Forums</a>
Davide Zanotti
Greenhorn

Joined: May 05, 2007
Posts: 7
Originally posted by rohit leeta: You need find/extract those icons and use from your java program by specifying their paths.


OK, and is it possible to know the path "automatically"? (something like System.getProperty("icons.MYICON"))
Actually i don't think those icons will look good in a java application. Try searching "Java look and feel guidlines", there are a couple of Java-compatible icons there.
I don't understand what do you mean with "i don't think those icons will look good in a java application", and anyway I'm not looking for icons to use in my application, but I would like to find a way to retrieve the original system icons with Java (that is, if I'm on OS X, I'll get the blue folder icon and if I'm on Windows I'll get the yellow folder icon)
[ May 05, 2007: Message edited by: Davide Zanotti ]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14430
    
  23

On Windows, those icons are not simply files that are somewhere on your harddisk; the images are hidden away in a DLL somewhere. So there's no way to find the path of an image file that contains the icon, because the icons are not simply image files.

The Java API does not contain any method to get to those icons. Ofcourse this functionality is very platform-specific, on Windows icons probably work very differently than on the Mac or on a Linux desktop.

If you really want to do this, you'll have to write some native code and call that via JNI. Ofcourse the native code will be different for each OS that you want your Java program to work on.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Davide Zanotti
Greenhorn

Joined: May 05, 2007
Posts: 7
thanks Jesper, now I'm taking a look to http://en.wikipedia.org/wiki/JNI
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retrieve system icons