Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

How is swing called light weight component

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

...Lightweight components can be more efficient at utilizing system resource...


Which does not rule out the possibility that they are less efficient...
 
Suresh Bab
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic