Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Java macintosh 10.8 integration

  1. #1
    Member Cronus's Avatar
    Join Date
    Feb 2013
    Location
    Gothenburg, Sweden
    Posts
    41
    My Mood
    Inspired
    Thanks
    6
    Thanked 7 Times in 6 Posts

    Angry Java macintosh 10.8 integration

    Hi all,

    I'm currently developing my very first "professional" software that actually does something useful. The head-OS is macintosh. Everything I've done so far is promising (according to me), but something annoys me, see. It doesn't have a native look and feel, it looks cross-platformed and weird. The most visual damage is the JMenuBar. It is displayed on the frame (http://alvinalexander.com/apple/mac/.../1-initial.jpg), meanwhile, other programs have their JMenuBars at the top of the screen (https://developer.apple.com/library/.../file_menu.jpg). I tried the Java Development Guide for Mac (https://developer.apple.com/library/...velopment.html), but I was greeted with an annotation saying it was deprecated. I also tried the Maven Plugin, but I have no idea where and how to start. I tried typing actual code too, like:
    java -Dapple.laf.useScreenMenuBar="true" com.example.yourApp
    And
    System.setProperty("apple.laf.useScreenMenuBar", "true");
    But none worked. I also tried to get into info.plist stuff, how do I integrate Java with .plist? I feel extremely hopeless. What should I do? how did YOU tackle this when trying to create a native Mac software? Thank you.

    NOTE: I DID IT! AFTER 9 HOURS OF SEARCHES! ALL YOU HAVE TO DO IN ORDER TO MODIFY THE JMENUBAR IS TO SIMPLY TYPE THE FOLLOWING INTO THE MAIN:
     String os = System.getProperty("os.name").toLowerCase();
            if(os.indexOf("mac") >= 0) {
                System.setProperty("apple.laf.useScreenMenuBar", "true");
            }


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,334
    Thanks
    181
    Thanked 830 Times in 773 Posts
    Blog Entries
    5

    Default Re: Java macintosh 10.8 integration

    For what its worth, I wrote an article about this recently on my website. I'll reference it here as it might have some other tips in there to help you out.
    Deploying a Java Application As a Native Mac

  3. The Following User Says Thank You to copeg For This Useful Post:

    Cronus (July 11th, 2013)

  4. #3
    Member Cronus's Avatar
    Join Date
    Feb 2013
    Location
    Gothenburg, Sweden
    Posts
    41
    My Mood
    Inspired
    Thanks
    6
    Thanked 7 Times in 6 Posts

    Default Re: Java macintosh 10.8 integration

    Thanks for the heads-up. I read your well-written and educated article in a hurry, so I might have missed the answer of my following question. Would you possibly know how stuff like naming your application, adding the MenuItems "Preferences", "About, and "Quit" work? When you run a program and press the name, a tab pops up with various labels. How do you implement these labels? I know it has to do with "info.plist". Thanks, guru.

  5. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,334
    Thanks
    181
    Thanked 830 Times in 773 Posts
    Blog Entries
    5

    Default Re: Java macintosh 10.8 integration

    Quote Originally Posted by Cronus View Post
    Thanks for the heads-up. I read your well-written and educated article in a hurry, so I might have missed the answer of my following question. Would you possibly know how stuff like naming your application, adding the MenuItems "Preferences", "About, and "Quit" work? When you run a program and press the name, a tab pops up with various labels. How do you implement these labels? I know it has to do with "info.plist". Thanks, guru.
    Not sure what you mean by naming the app and 'press the name', but to react to the Preferences, About, and Quit menu selections you have to implement the appropriate interfaces - this is outlined in the Mac/Apple OS notifications section of the article. You basically need to add the jar that contains the appropriate interfaces to your class path, then implement the interfaces/listeners and set them using the Application class. Not sure if the API is online anymore for this package, and I'm not on a mac at the moment so can't comment exactly which interfaces are available and how to correctly set them. Further, I don't recall right now, but these may not fire until the application is bundled.

  6. #5
    Member Cronus's Avatar
    Join Date
    Feb 2013
    Location
    Gothenburg, Sweden
    Posts
    41
    My Mood
    Inspired
    Thanks
    6
    Thanked 7 Times in 6 Posts

    Default Re: Java macintosh 10.8 integration

    Thanks man, I was just scrolling around.

Similar Threads

  1. Java integration with magento web services issue
    By prabhumachismo in forum Web Frameworks
    Replies: 1
    Last Post: November 22nd, 2012, 04:34 AM
  2. JAVA TaskBar toolbar integration
    By WilyZ in forum Java Theory & Questions
    Replies: 1
    Last Post: October 27th, 2012, 04:15 PM
  3. Java/Excel integration, Reading in Dates
    By aussiemcgr in forum JDBC and Database Tutorials
    Replies: 0
    Last Post: July 16th, 2010, 08:38 AM
  4. Java/Excel integration, Reading in Dates
    By aussiemcgr in forum Java Code Snippets and Tutorials
    Replies: 0
    Last Post: July 16th, 2010, 08:38 AM

Tags for this Thread