Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieve system icons

 
Davide Zanotti
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to retrieve the system's icons? (for example the folder icon)
 
rohit leeta
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Davide Zanotti
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15495
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Davide Zanotti
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Jesper, now I'm taking a look to http://en.wikipedia.org/wiki/JNI
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic