Advanced Java Programming - Old Questions

6. What are the benefits of using swing components? Explain.

5 marks | Asked in 2072

Java Swing is a lightweight Graphical User Interface (GUI) toolkit that includes a rich set of widgets. The javax.swing package provides classes for java swing API such as JButton, JTextField, JTextArea, JRadioButton, JCheckbox, JMenu etc.

The benefits of using swing components are

  • Swing provides both additional components and added functionality to AWT-replacement components 
  •  Swing components can change their appearance based on the current "look and feel" library that's being used. 
  •  Swing components follow the Model-View-Controller (MVC) paradigm, and thus can provide a much more flexible UI. 
  • Swing provides "extras" for components, such as:  Icons on many components  Decorative borders for components 
  • Tool tips for components 
  •  Swing components are lightweight (less resource intensive than AWT) 
  •  Swing provides built-in double buffering 
  • Swing provides paint debugging support for when you build your own components