Link to home
Start Free TrialLog in
Avatar of gdancelli
gdancelli

asked on

How can I manage icon overlyaing in Windows with Java ?

Hi to all,

Is it possible to handle icon overlays in Windows from a Java app. ?
To better clarifiy, I have to reproduce what DropBox does on system icons, by adding some green checks, question marks, etc. on bottom right corner of each file icon handled by my app. depending on their status.
The icons overlay must be visible also from windows Explorer.
I know how to do it in C++ (a COM shell extension), but not in Java.

Thanks a lot.
Avatar of for_yan
for_yan
Flag of United States of America image

Are you talking about some say selection list of files in yoiur Java application ?
Avatar of gdancelli
gdancelli

ASKER

Yes.
In the beginning I planned to do something similar to a shell extension, the way that Windows actually handles icon overlays, but as I have to deal with multiplatform, it's probably better that I show the icons in a form of my java app. I can reproduce in java something similar to the Windows Explorer and then change the files icons in my app. only.
At this point, I need some information on how to retrieve from java the icons of the files in the folder that I'm inspecting and change  their icons by adding overlays according to a status.
Thanks.
Are you using JFileChooser or your custom class to display files?
I'm not sure I understand what means "overlays" ?
Avatar of Pramod Kumar
If i understood u correct, then on OS file list screen, you want to modify the default file/folder icon, right.
If yes, then you already told that you know how to do in C++, so why not make a native code and call it from java using JNI.

http://jovial.com/javaAndCpp/java_and_cpp.html
Yes, I considered to call a native code from JNI, but as I have to deal with multiplatform, I was wondering if Java implements something similar without the aim of C++.
As it seems to be an operating system dependent feature (handling is different among various system), you must write different 'shell extensions' for each OS; that's not my goal.
At the end, I decided to show the folder icons in Java tree, where the file icons will be changed accordingly to a status; of course, outside the app. the system will show normal icons.
JFileChooser is not the right choice I believe as I need to reproduce a directory tree navigation only, showing files with their respective icons in a java form. No user action will be taken on that tree from Java, just display the correct files icons augmented with small bitmaps showing the file status (green checks, red crosses etc.), exactly like dropbox does.

Thanks.
I don't think there is something which would not allow you to create such
display with icons and checkboxes using only Java with custom renderers,
and I don't think you'll need to use JNI for that purpose.
It will certainly take a bit of work, but seems to be doable.
ASKER CERTIFIED SOLUTION
Avatar of Pramod Kumar
Pramod Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks a lot for sample code!