This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Swing Renders Native Controls? (getSystemLookAndFeelClassName) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Swing Renders Native Controls? (getSystemLookAndFeelClassName)" Watch "Swing Renders Native Controls? (getSystemLookAndFeelClassName)" New topic

Swing Renders Native Controls? (getSystemLookAndFeelClassName)

Bryan Cairns

Joined: Oct 27, 2007
Posts: 10
I have a read several books on java and studying for the SCJP exam.

Everything I have read says that Java draws the controls (for example a button). Where other languages / frameworks like .Net, QT framework, SWT, and wxWidgets create instances of the native controls from the OS.

That swing will create instances of native controls rather then draw them when you use:

Can anyone shed some light on this?

Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2155
The default Look and Feel (LAF) for Swing is the Metal LAF.

When you use: UIManager.getSystemLookAndFeelClassName() it doesn't not mean that native controls will be used. It means that Swing will use the default LAF for the platform the application is running on. The controls will be painted by Swing to look like the controls for that platform.
Bryan Cairns

Joined: Oct 27, 2007
Posts: 10
One thing I found on google:

Both WindowsLookAndFeel and GTKLookAndFeel are using native invocations to paint themselves. That's why they are using much more memory than "pure java" LookAndFeels, because abstraction level is doubled
I agree. Here's the link:
subject: Swing Renders Native Controls? (getSystemLookAndFeelClassName)
Similar Threads
Architecting Swing apps - best practices?
Character by Character input
Swing on the browser
JavaFX / Swing/ JSF