PDA

View Full Version : App Icon in "About..." Box




stadidas
Mar 1, 2006, 01:05 PM
I have a custom AboutBox.Java file, as created by XCode for a Swing Java app. I don't wish to use the dfault about box because I can't edit the system version etc that appear in it.
My only issue is I cannot get my application's icon to appear in the about box. I'm sure it isn't difficult to do, but I'm new to Java, and even newer to Java for OS X. Any help would be greatly appreciated.



caveman_uk
Mar 1, 2006, 01:39 PM
For cocoa apps the icon that's used is defined in the Info.plist file. There's a key called CFBundleIconFile and it's value is the name of the icon to be used that's in the apps resources.

What Java does I don't know but maybe it's the same deal?

stadidas
Mar 2, 2006, 08:03 AM
Well the code I have for building my about box is:

aboutLabel = new JLabel[labelCount];
aboutLabel[0] = new JLabel("");
aboutLabel[1] = new JLabel(resbundle.getString("frameConstructor"));
aboutLabel[1].setFont(titleFont);
aboutLabel[2] = new JLabel(resbundle.getString("appVersion"));
aboutLabel[2].setFont(bodyFont);
aboutLabel[3] = new JLabel("");
aboutLabel[4] = new JLabel("");
aboutLabel[5] = new JLabel("JDK " + System.getProperty("java.version"));
aboutLabel[5].setFont(bodyFont);
aboutLabel[6] = new JLabel(resbundle.getString("copyright"));
aboutLabel[6].setFont(bodyFont);
aboutLabel[7] = new JLabel(resbundle.getString("copyright2"));
aboutLabel[7].setFont(bodyFont);
aboutLabel[8] = new JLabel("");

Basically I need some code at the top of that which will display the application icon. Apple's default about box does it, but I don't have the code for that.

grabberslasher
Mar 2, 2006, 09:40 AM
Well the code I have for building my about box is:

aboutLabel = new JLabel[labelCount];
aboutLabel[0] = new JLabel("");
aboutLabel[1] = new JLabel(resbundle.getString("frameConstructor"));
aboutLabel[1].setFont(titleFont);
aboutLabel[2] = new JLabel(resbundle.getString("appVersion"));
aboutLabel[2].setFont(bodyFont);
aboutLabel[3] = new JLabel("");
aboutLabel[4] = new JLabel("");
aboutLabel[5] = new JLabel("JDK " + System.getProperty("java.version"));
aboutLabel[5].setFont(bodyFont);
aboutLabel[6] = new JLabel(resbundle.getString("copyright"));
aboutLabel[6].setFont(bodyFont);
aboutLabel[7] = new JLabel(resbundle.getString("copyright2"));
aboutLabel[7].setFont(bodyFont);
aboutLabel[8] = new JLabel("");

Basically I need some code at the top of that which will display the application icon. Apple's default about box does it, but I don't have the code for that.

Well, you could always make a new nsimageview, and set its image to the NSImage.imageNamed("NSAppIcon.icns")

stadidas
Mar 2, 2006, 01:20 PM
Ok, but how do I implement that?