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
On Thu, 28 Jul 2005, Mark A. O'Neil wrote:
| I wrote a while back about the menu crashing an app we are working on. I have
| since lost the email and cannot find reference via archive searches, but to
| the best of my I recollection the fix was to have the app display it's menus
| in the jFrame.
|
| Ideally, for the time being, I would be able to use the System LAF and have
| the jFrame(s) have their own menus.
|
| Please confirm that the following code should do the trick:
| javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeel());
| javax.swing.UIManager.put("apple.laf.useScreenMenuBar", "false");
|
| the second line has no effect. If it should do the trick then something is up.
| Suggestions welcome.
|
| Interestingly the app runs fine as is on my system, but fails on three other
| systems (new G5 and older G4 hardware) with the same Tiger/Java
| versions...haven't tracked that one down yet.
|
| FWIW the crash completely disappears on all systems, if I use the Metal PLAF
| (all the non-Aqua PLAFs actually).
|
| thanks,
| -m
|
| _______________________________________________
| 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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Larry Nussbaum Imagination
email@hidden is more important than
Knowledge
_______________________________________________
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