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 How is swing called light weight component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How is swing called light weight component" Watch "How is swing called light weight component" New topic
Author

How is swing called light weight component

Suresh Bab
Greenhorn

Joined: Nov 30, 2006
Posts: 14
Hi all,

I am new to swing and i would like to know that how is swing different from that of applet ???

Also how is swing a light weight component and why is it not useful for web applications ???

thanks,
Suresh
Henrik Engert
Ranch Hand

Joined: Apr 26, 2005
Posts: 70
Google is fantastic

A lightweight component is one that subclasses java.awt.Component (or java.awt.Container) directly - implementing the look-and-feel of the component in Java rather than delegating the look-and-feel to a native peer. Lightweight components can be more efficient at utilizing system resource, they can be transparent, and they do not have to be rectangular (all of which are limitations when working with components that have a peer).


You can use JApplet to develop Applets in Swing. JApplet is a subclass of java.applet.Applet.
[ January 30, 2007: Message edited by: Henrik Engert ]

SCJP 5.0, SCWCD
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
...Lightweight components can be more efficient at utilizing system resource...

Which does not rule out the possibility that they are less efficient...


Ping & DNS - updated with new look and Ping home screen widget
Suresh Bab
Greenhorn

Joined: Nov 30, 2006
Posts: 14
Hi,


Thanks a lot for your information. I have some more queries ...

Whether all the swing components are subclassing Component or Container ???
Whether there is any life cycle events as we have in applet ???

another question why does applet called a heavy weight component ??? whether it doesnt extends Component or container ???

Thanks,
Suresh Babu
Henrik Engert
Ranch Hand

Joined: Apr 26, 2005
Posts: 70
JComponent is the base class for all Swing components except top-level containers. JComponent extends Container.

It is all in the Javadoc for Swing.

I found this by searching with Google:

The only heavyweight components used in Swing are:

swing.JFrame
swing.JDialog
swing.JWindow
swing.JApplet
All AWT components (awt.*), except those noted below.
All other Swing components are lightweight. Swing's lightweight components are:

awt.Component
awt.Container
swing.JComponent
All other Swing classes (swing.*) and all packages under it, except for those noted above.

[ January 30, 2007: Message edited by: Henrik Engert ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How is swing called light weight component
 
Similar Threads
what does light weight component mean?
Swing an AWT
How to insert java code in Static HTML page ?
Interview questions
Heavy weight vs. Light weight component