Java Swing Question and Answers

9. Does Swing is thread safe?
 
  • Since Swing components are not thread safe it means you cannot update these components in any thread other than Event Driven Thread.
  • If you do so you will get unexpected behavior.
  • Some time interviewer will also ask what are thread safe methods in swing which can be safely called from any thread only few like repaint() and revalidate().
 
Your Name Your Email-ID
Your Answer
10. What are peerless components?
  The peerless components are called light weight components.
 
Your Name Your Email-ID
Your Answer
11. What advantage do Java's layout managers provide over traditional windowing systems?
 
  • Java uses layout managers to lay out components in a consistent manner across all windowing platforms.
  • Since Java's layout managers aren't tied to absolute sizing and positioning, they are able to accommodate platform specific differences among windowing systems.
 
Your Name Your Email-ID
Your Answer
12. Which package has light weight component?
 
  • javax.Swing package contains light weight components.
  • All components in Swing, except JApplet, JDialog, JFrame and JWindow are lightweight components.
 
Your Name Your Email-ID
Your Answer
123456789 Page 3 of 9