Header Ads

  • Breaking Now

    What are lightweight and heavyweight components ?

    In AWT, all GUI controls are referred as heavyweight components as they are dependent on underlying OS(e.g. Windows,Solaris etc.) to provide it(paint it and redraw it).An AWT button control in MacOS is actually a MacOS button.
    All Swing components are lightweight components(except for the top-level ones: JWindow, JFrame, JDialog, and JApplet) as they do not require underlying OS to provide them.JVM renders Swing components and hence they are platform independent but they have performance related issues as compared to heavyweight components which are faster to be rendered due to hardware acceleration.
    The lightweight components have transparent pixels unlike heavyweights which have opaque pixels.Mouse events on a lightweight component fall through to its parent; while on a heavyweight component it does not.It is generally not recommended to mix heavyweight components with lightweight components while building the GUI.

    Post Top Ad

    Post Bottom Ad