App Icon in "About..." Box

Discussion in 'Mac Programming' started by stadidas, Mar 1, 2006.

  1. macrumors regular

    Joined:
    Feb 27, 2006
    Location:
    Kent, United Kingdom
    #1
    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.
     
  2. Guest

    caveman_uk

    Joined:
    Feb 17, 2003
    Location:
    Hitchin, Herts, UK
    #2
    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?
     
  3. thread starter macrumors regular

    Joined:
    Feb 27, 2006
    Location:
    Kent, United Kingdom
    #3
    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.
     
  4. macrumors 6502

    Joined:
    Aug 2, 2002
    Location:
    Éire
    #4
    Well, you could always make a new nsimageview, and set its image to the NSImage.imageNamed("NSAppIcon.icns")
     
  5. thread starter macrumors regular

    Joined:
    Feb 27, 2006
    Location:
    Kent, United Kingdom
    #5
    Ok, but how do I implement that?
     

Share This Page