• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Swing Renders Native Controls? (getSystemLookAndFeelClassName)

 
Bryan Cairns
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
UIManager.getSystemLookAndFeelClassName()

Can anyone shed some light on this?

 
Rob Camick
Ranch Hand
Posts: 2614
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One thing I found on google:

http://forum.kde.org/viewtopic.php?f=15&t=37490


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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic