aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Do Swing Components (but 4) look identical for Operating Systems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Do Swing Components (but 4) look identical for Operating Systems" Watch "Do Swing Components (but 4) look identical for Operating Systems" New topic
Author

Do Swing Components (but 4) look identical for Operating Systems

Jeffry Cray
Greenhorn

Joined: Oct 08, 2000
Posts: 25
I've looked all over and investigated alot. But still for some reason I still have one doubt, becuase swings are still vauge to me.
Do all(but 4) swing components "LOOK IDENTICAL" for all OS for the same program. Or are they just consistent (i.e. their image can be customized and will look that they were made for that particulat OS) or both ?
thanks
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Both.
They will look very similar (font sizes may vary) on all systems. That is one reason for Swing. Each component handles its own rendering therefore they will be drawn the same on all systems.
You can also force the Swing components to look like Motif, Windows, or Metal on all systems. If you just use Swing components without setting a look-and-feel you will see the Swing default (Metal). You can however force Swing to use Windows look-and-feel which would then draw Windows type components on all systems.
Wow the power of Swing!
Manfred.
Jeffry Cray
Greenhorn

Joined: Oct 08, 2000
Posts: 25
Thanks Manfred,
Now I'm finally beginning to understand, but what do you mean by Metal and Motif OS .
Kaustuv Bhattacharya
Greenhorn

Joined: Jan 18, 2001
Posts: 7
There are 3 look&feels for the Swing Components,namely, Metal, Motif and Windows. They differ in the looks of the components.
You can use the Java Packages :
1)javax.swing.plaf.metal.MetalLookAndFeel - Metal Look
2)com.sun.java.swing.plaf.motif.MotifLookAndFeel - Motif Look
3)com.sun.java.swing.plaf.windows.WindowsLookAndFeel - Window Look
With Regards,
Kaustuv
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
The AWT uses heavyweight components, and Swing uses lightweight components.
Heavyweight components rely on peer functions provided by the underlying operating system, and as such require much more system resources. The Look and Feel is determined by the operating system.
Lightweight components are completely removed from the operating system and rely only on java. They always have the same Look and Feel except when specifically set differently (as described above).

"JavaRanch, where the deer and the Certified play" - David O'Meara
Jeffry Cray
Greenhorn

Joined: Oct 08, 2000
Posts: 25
Thank you all,
I think know I'm alot more familiar with swings.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Do Swing Components (but 4) look identical for Operating Systems