Help coderanch get a
new server
by contributing to the fundraiser
  • 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

Retrieve system icons

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a way to retrieve the system's icons? (for example the folder icon)
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Jesper, now I'm taking a look to http://en.wikipedia.org/wiki/JNI
 
Any sufficiently advanced technology will be used as a cat toy. And this tiny ad contains a very small cat:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic