Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Menu error crashes app: Swing, apple.laf, and useScreenMenuBar



Larry,

That was just the ticket - I had the calls in the right order in my original code, but I was not using System.setProperty I was using the UIManger.put which was just wrong, obviously.

Thank you!

-m

On Jul 28, 2005, at 1:20 PM, Lawrence Nussbaum wrote:

Mark,

You need to put stuff in the environmnet prior to making any calls that
would cause the GUI to start. In my apps I do it in the main routine,
before calling anything else.


So it should be something like:

void main()...

    // set up platform UI specific stuff here...
    if ( System.getProperty( "os.name" ).startsWith( "Mac OS" )) {

// Mac Java 1.3
System.setProperty( "com.apple.macos.useScreenMenuBar", "true" );
System.setProperty ( "com.apple.mrj.application.growbox.intrudes", "true" );
System.setProperty( "com.apple.hwaccel", "true" ); // only needed for 1.3.1 on OS X 10.2
System.setProperty ( "com.apple.mrj.application.apple.menu.about.name", "Visitour" );


        // Mac Java 1.4
        System.setProperty( "apple.laf.useScreenMenuBar", "true" );
        System.setProperty( "apple.awt.showGrowBox", "true" );

        // Mac Java 1.5
        // TBD...
    }

    try {
        String s;
        if ( myProps.getPropertyB( NATIVELAF ))
            s = UIManager.getSystemLookAndFeelClassName();
        else
            s = UIManager.getCrossPlatformLookAndFeelClassName();

        if ( false )
            s = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";

        UIManager.setLookAndFeel( s );
        s = null;

    } catch (Exception e) {
        System.err.println( "Error Initializing Look and Feel: " + e);
        e.printStackTrace();
    }


Hope that works for you,

Larry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Menu error crashes app: Swing, apple.laf, and useScreenMenuBar (From: "Mark A. O'Neil" <email@hidden>)
 >Re: Menu error crashes app: Swing, apple.laf, and useScreenMenuBar (From: Lawrence Nussbaum <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.