File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes swings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "swings" Watch "swings" New topic
Author

swings

NIKHIL EROS
Greenhorn

Joined: Sep 21, 2001
Posts: 17
i want to know what actually is meaning between light weight and heavy weight components, but not in BIG TECHNICAL JARGAINS!!.
also please anybody tell me what is the difference between a TRANSPARENT and OPAQUE object or component in swings!!
thanks in advance
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Heavyweight components are generally AWT components like Canvas, ScrollPane, Panel, etc. The reason they are called heavyweight is because they are ALWAYS painted on top.
Swing components are considered Lightweight because unless specified otherwise, they are ALWAYS painted on the bottom.
The difference between transparent and opaque is you can see through transparent. Opaque is Solid. Now, with that being said, I personally haven't ran across a situation where that mattered.
If you go to java.sun.com and go through some of the tutorials, specifically the SWING tutorial, most of this stuff is in there. The very first paragraph of the SWING tutorial tells you what a heavyweight component is. I'm just telling you this because I have asked similar questions when I was first starting and people would just reply with "Look at the API". But what I learned was, it DOES help to look at the API and the tutorials BEFORE asking questions. Then, if you still don't understand, ask away.
Good Luck!!

------------------
Happy Coding,
Gregg Bolinger


GenRocket - Experts at Building Test Data
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Put another way people are more inclined to help someone who has tried to help themselves than one who just is looking for the easy way out.
This is not implying that the original question was looking for the easy way out.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Nikhil,
Gregg is correct in his discussion about Transparent and Opaque.
The correct reason that Swing components are called light weight and AWT components are called heavy weight is because Swing is not implemented using native code( operating system), which is considered bulky or heavy. Therefore, it is considered light weight!
All AWT components were implemented by the operating system in which the JVM was running. Since that was the case, a single application would look different running on different systems.
Most Swing components are drawn themselves (in java API). This allows the components much more flexibility in actions and look and feel. Some Swing components are still considered heavy weight:
JWindow
JFrame
JApplet
These are still dragging around native methods. That is the reason why a JFrame in Windows will look like a Windows window and a JFrame on Unix will look like a Motif window.
Regards,
Manfred.
NIKHIL EROS
Greenhorn

Joined: Sep 21, 2001
Posts: 17
Thanks a lot Manfred Leonhardt for giving me such a nice and easy reply. I have gone thro various articles on this on Sun Java site, but u have given the most brief and easy to understand solution.
Thanks a lot!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: swings