Home > Articles > Programming > User Interface (UI)

📄 Contents

  1. Installation
  2. Operating System Uniqueness
  3. Conclusion
  • Print
  • + Share This
Like this article? We recommend

Operating System Uniqueness

Once your application is installed properly, the next thing the user sees is your masterful GUI itself. But does your GUI behave natively? When the user presses the keyboard shortcut to quit the application, does it quit? Each operating system on which you deploy has its own set of quirks. While it might not be possible to behave 100 percent perfectly on each operating system, it is important that the developer take the time to identify these quirks and do his or her best to respond properly. Here are a couple to consider.

Windows

Fortunately, the designers of Swing had Windows in mind when they designed it. In the more recent versions of Java, it is even possible to assume some of the themes that are available in the more recent versions of Windows. Therefore, very little consideration needs to be taken when ensuring that your Java application runs properly on Windows.

OS X

As I am sure nearly everyone knows by now, OS X has a single menu bar that always sits at the top of the screen. Unlike Windows, the actual application window never has a menu bar and only rarely has a toolbar. Fortunately, Swing supports the screen menu bar for OS X automatically if the menu bar is built properly. The following property merely needs to be set to true prior to any Swing initialization:

apple.laf.useScreenMenuBar

This can be set either in the Info.plist file that is required as part of a OS X application or it can be set via System.setProperty(). If it is set programmatically, it is best to set it in the applications Main method prior to any GUI initialization code.

There are a few other properties that can be set that OS X will recognize. It is possible to have your application use the metal look and feel on OS X and to specify whether the grow box icon is displayed in the lower-right corner as well as a few other behavior controls. All these properties can be reviewed on Apple’s developer website.

  • + Share This
  • 🔖 Save To Your Account