-1

I'm working in eclipse and I have made an application without name and icon. When i start the application it's a really creepy name displaying in the upper left corner (Mac). It's some thing like. I wonder how I can change this to my own name. Second question is how i can change the icon. Can I do that in eclipse?

ntoonio
  • 3,024
  • 4
  • 24
  • 28
  • 1
    Can you post a screenshot of exactly what you're talking about? Are you talking about the icon of a JFrame? The icon of a jar? Something else? – Kevin Workman Jan 07 '14 at 19:54
  • the icon of the application, or .jar. I could not upload a picture for some reason. – ntoonio Jan 07 '14 at 19:59
  • Basically, you can create a application bundle, as described. [here](http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html), or, if you can find some documentation, use the com.apple.eawt.Application API. But the documentation is VERY light... – MadProgrammer Jan 07 '14 at 20:16

3 Answers3

0

If you're using JFrames, you can try setting the icon image as follows.

frame.setIconImage(img); 

Also, by name it sounds a bit like you mean the frame's title. When you create the a frame, you can set the title as follows:

Frame frame = new JFrame("Title goes here");
Sophicles
  • 64
  • 8
0

To change name: How to change an Android app's name?

To change icon: How to change the icon of an Android app in Eclipse?

It's already here at stackoverflow, please check if your answers are here before posting.

Community
  • 1
  • 1
Mattias F
  • 602
  • 6
  • 11
0

The prefered method would be to create a Mac OS application bundle (and the bundler), but if this seems like to much work, you can supply custom properties to, for example, you could supply the Xdock:name property when running the application, for example...

-DXdock:name="Application Name"

If you can't do that, you can set it when your application runs, for example...

public static void main(String[] args) {
    try {
        // Sets the application name on the menu bar
        System.setProperty("Xdock:name", "Application Name");

        // Set the applications dock icon...
        Application application = Application.getApplication();            
        application.setDockIconImage(ImageIO.read(TestDockIcon.class.getResource("/Icon.png")));

        // Start the application...
        new TestDockIcon();
    } catch (IOException exp) {
        exp.printStackTrace();
    }
}
MadProgrammer
  • 343,457
  • 22
  • 230
  • 366