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: JMenuBar



Michael,

Go to the Apple Developer web site, they have plenty of articles on doing 
this. One thing to consider is to use an application bundle for OS X; it 
affords your user a more 'mac-like' environment - although you can do the 
same with just a jar file.

Here is some sample code I use for cross platform customization:

Larry


---------------
// 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" );
		
}

try {
	String s;
	if ( vProps.getPropertyB( VTProps.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();
}
		

---------------

On Sat, 18 Dec 2004, Michael Banzon wrote:

| Hi,
| 
| I'm developing an application for a cross platform env. and have a
| question about the menu bar.
| 
| Normally (coming from Windows and Linux) I would do my code
| in Swing using a JFrame setting the JMenuBar, which would provide
| a menu for the window. Though, on MacOSX it's custom to make use
| of the Cocoa (correct me if I'm wrong here) style menus, that is places
| outside the program window in the top of the screen.
| 
| I would like to make my program run ordinarily on Windows/Linux and
| use the feature described above when running on MacOSX. Any suggestions
| on how to come around this in a good manner???
| 
| Thanks in advance ;-)
| 
| -- 
| Michael Banzon
| http://michael.banzon.dk/
| 
| I think, therefore iBook...
|  _______________________________________________
| 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

References: 
 >JMenuBar (From: Michael Banzon <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.