Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > IconRef to ImageIcon

IconRef to ImageIcon
Thread Tools
Forum Regular
Join Date: Jan 2001
Location: Boston, MA
Status: Offline
Reply With Quote
Sep 21, 2001, 08:25 AM
 
I'm writing some apps in Cocoa using Java, which I love. However, I need to call into the Carbon Toolbox and have found the JDirect3 bridge libraries, but am confused about how to turn one datatype into another. I want to be able to call Carbon's IconServices API from Java, which is possible, but I then need to somehow translate an IconServices opaque IconRef into something like a javax.swing.ImageIcon for display in a JTable or inside of a Cocoa NSOutlineView as an NSImage. Is there any way I can get the raw bytes of the IconRef and then create a new NSImage or ImageIcon from it? I've looked through the IconServices API but no such function jumped out at me. Any help would be greatly appreciated.
     
Senior User
Join Date: Mar 2000
Location: Ithaca, NY
Status: Offline
Reply With Quote
Sep 22, 2001, 11:50 AM
 
If you just want to grab the icon for a file or a type of file, you could use the NSWorkspace methods iconForFile: and iconForFileType:
     
SoClose  (op)
Forum Regular
Join Date: Jan 2001
Location: Boston, MA
Status: Offline
Reply With Quote
Sep 22, 2001, 02:46 PM
 
Originally posted by bewebste:
<STRONG>If you just want to grab the icon for a file or a type of file, you could use the NSWorkspace methods iconForFile: and iconForFileType:</STRONG>
Thanks for the suggestion. One thing I was interested in was using the IconServices APIs to get icons for various system components, like the special folder icons, special Finder icons, etc. I think I may have figured out how to obtain the pointer from the opaque IconRef and get the raw bytes of the data. I can then feed that into a java.awt.image.ImageConsumer object and create a new Image object. At least I hope I can. Any other tips would be very welcome!
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:19 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2