Lightweight versus Heavyweight Components

HeavyWeight

 

  • Used by the AWT

Lightweight

 

Rectangular Can be any shape
Opaque Can have transparent portions
Always drawn over top of lightweight components Can overlap each other
  Mouse events fall through transparent portions

Rely on native peers

 

Does not rely on native peers

 

Look and Feel tied to operating system

Look and Feel drawn at runtime so can vary

functionality determined by operating system

functionality is the same on all platforms

faster, because the OS handles the work

slower because Java has to do the work

© Lynne Grewe 2001