Java app on Mac Question (program name display)

Discussion in 'Mac Programming' started by plinden, Nov 11, 2006.

  1. plinden macrumors 68040

    plinden

    Joined:
    Apr 8, 2004
    #1
    I'm a Java programmer with loads of experience in application code but none in GUI development. I decided to get some experience by writing a crossplatform GUI frontend to some web-related Java utilities I wrote, so I'm doing a simple GUI using Swing and Eclipse.

    Now, I want this to work like a Mac program as well as on Windows and Linux. For the Mac I am able to get the screen menu bar displaying the menus, but I can't work out how to display the application name properly, and I can't find anything online (I can do this in XCode, but like I said, I want to use Eclipse so I'm sure it's crossplatform). See the screen shot. Anyone with Java+Swing+Mac experience know how to modify this?
     

    Attached Files:

  2. therevolution macrumors 6502

    Joined:
    May 12, 2003
    #2
  3. plinden thread starter macrumors 68040

    plinden

    Joined:
    Apr 8, 2004
    #3
    Thanks, that works. I missed that when I read the Apple docs.
     
  4. rand0m3r macrumors regular

    Joined:
    Jun 30, 2006
    #4
    just wondering. are you saying that you can write a program in java and use the cocoa framework to put an aqua interface on it, while it still maintains its java swing GUI on non-Mac platforms?
     
  5. plinden thread starter macrumors 68040

    plinden

    Joined:
    Apr 8, 2004
    #5
    No, it won't be Cocoa, just a Swing GUI on all OSs - you can follow the Mac OS guidelines though, by checking the OS and if it's OS X, move the menu bar to the top and bind the application menu items differently (ie. if it's OS X use Preferences, About etc instead of menu items.)

    I might look into doing it as a Cocoa app in XCode though. I'm using the classic MVC architecture so I can do the UI differently. But I'm much more experienced in using Eclipse so that's what I'm doing first.
     
  6. therevolution macrumors 6502

    Joined:
    May 12, 2003
    #6
    You don't use Cocoa to get the Mac look and feel in Java Swing apps. In fact, they look that way by default on Mac OS X - if you want to utilize a different Java look and feel, you have to explicitly change it. And yes, on non-Mac platforms you just specify another look and feel or use whatever defaults exist for that platform.
     

Share This Page