Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

stadidas

macrumors regular
Original poster
Feb 27, 2006
243
0
Kent, United Kingdom
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

Guest
Feb 17, 2003
2,390
1
Hitchin, Herts, UK
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

macrumors regular
Original poster
Feb 27, 2006
243
0
Kent, United Kingdom
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

macrumors 6502
Aug 2, 2002
409
1
Éire
stadidas said:
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")
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.