Re: [Java-gnome-developer] Set window icon without org.gnome.gtk.Window?
Brought to you by:
afcowie
From: Ethan Tira-T. <ej...@cm...> - 2010-06-21 05:43:09
|
>> I just want to set the application icon for the window in the task switcher so it's not just the generic java app icon. I don't want to have to rewrite all the UI stuff though just for this minor issue > > Maybe the Gtk.setDefaultIcon(Pixbuf) function is what you are looking > for. Ah, almost... I got excited there, but this only seems to work for windows which extend org.gnome.gtk.Window; if it uses JFrame it only gets the generic icon. Just for reference how I've seen this addressed elsewhere, on OS X I can pass java -Xdock:icon=my_icon.png without having to modify any code... I quite like that solution for a basic branding issue like this. Alternatively, OS X also uses system properties to control some UI options via the look and feel module (e.g. -Dapple.laf.useScreenMenuBar=true), so I'd expect they could have done the icon setting the same way... However, setting via -X to java probably lets them load the icon right from the get-go, to display even before the classes are done loading into memory... *shrug* Anyway, doing some more searching, turns out Java 6 has this issue covered with a newly introduced "setIconImage" for the java.awt.Window, so I'm all set! http://java.sun.com/javase/6/docs/api/javax/swing/JFrame.html#setIconImage(java.awt.Image) Thanks! -Ethan |