• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

swings

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:)
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic