Java Swing Question and Answers

13. What is the difference between the Font and FontMetrics classes?
  The FontMetrics class is used to define implementation specific properties, such as ascent and descent of a Font object.
 
Your Name Your Email-ID
Your Answer
14. How can a GUI component handle its own events?
  A component can handle its own events by implementing the required event listener interface and adding itself as its own event listener.
 
Your Name Your Email-ID
Your Answer
15. Why swing is not thread safe?
 
  • The Swing API was designed to be powerful, flexible and easy of use.
  • In particular, we wanted to make it easy for programmers to build new Swing components, whether from scratch or by extending components that we provide.
  • For this reason, we do not require Swing components to support access from multiple threads.
  • Instead, we make it easy to send requests to a component so that the requests run on a single thread.
 
Your Name Your Email-ID
Your Answer
16. Name Container classes?
 
  • Window
  • Frame
  • Dialog
  • File Dialog
  • Panel
  • Applet or ScrollPane
 
Your Name Your Email-ID
Your Answer
123456789 Page 4 of 9