Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Java Swing GUI's don't look native by default (Except on Mac OS X for some reason). Swing uses it's own look and feel. You can get Swing to use the system look and feel by putting:


in the beginning of your main method, but: Why isn't this done by default?

share|improve this question
I'm pretty sure the intent is that it looks consistent by default. It'll look the same on every system, unless you explicitly tell it you don't want that behavior (with all the issues which may come with it). – Bobson Jun 14 '13 at 18:45
I think OSX looks more native than the others because Apple originally supported Java as a first-class programming language in OSX 10.1 and spent a lot of time polishing the Swing UI. – Ant Jun 14 '13 at 21:35
up vote 3 down vote accepted

Java language "philosophy" is WORA:

Java is ...intended to let application developers "write once, run anywhere" (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another.

Explanation for default given in Swing tutorial (Available Look and Feels) looks consistent with above:

CrossPlatformLookAndFeel — this is the "Java L&F" (also called "Metal") that looks the same on all platforms. It is part of the Java API (javax.swing.plaf.metal) and is the default...

Apparently, library designers decided that "CrossPlatform... looks the same on all platforms" deserves to be default for the library in the language primarily intended to be cross platform.

Marketing / designer dreams could play their role here, too. Every library designer hopes / expects it to be popular and widely used (otherwise, there's little sense to invest effort into it). If Swing designers expected it to be used very widely, consistent (not system dependent) L&F could be considered an advantage, so that users running the same (popular! how could it be different?) Swing application on different platforms would feel comfortable with familiar interface.

share|improve this answer

I did a lot of Swing programming in the late 90's, but I don't do very much nowadays, so I don't know if it's still an issue or not. It used to be the case that if you used a native look and feel, you'd occasionally run into layout issues when you ran it on another platform, due to slightly different control proportions and such. Using the default metal look and feel avoided those kinds of issues.

Of course there's always the more puerile possibility that Java likes their look and feel better and it's their language, so there :P

share|improve this answer
Makes sense. Although I don't understand why they made an exception for Mac OS X then... – Jop V. Jun 14 '13 at 19:56

I'm pretty sure that swing was designed to be lightweight with Java's (Sun's, now Oracle's) own widgets designed for cross platform usability. The graphics for the widgets look the same and are distributed along with the platform package. The native feels require interfacing with the OSes look and feel, which make it more heavyweight. Other GUI toolkits do this natively, like AWT.

share|improve this answer
On Ubuntu AWT doesn't look native either. – Jop V. Jun 14 '13 at 19:26
but swing's "native" look doesn't use any native controls besides the windows themselves, its implementation is reimplemented – ratchet freak Jun 14 '13 at 19:33
I see. I haven't programmed anything in Swing or AWT in ages, but I always knew that it was Sun's GUI kit - not at all anything to do with the OS. – Marc Marta Jun 14 '13 at 19:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.