Java Interview Questions - swing

1. What is the difference between Swing and AWT components?

Basically AWT came first and is a set of heavyweight UI components (meaning they are wrappers for operating system objects) whereas Swing built on top of AWT with a richer set of lightweight components.

2. What is the difference between scrollbar and scrollpane?

A Scrollbar is a Component. Scrollpane is a Container. It can handle its own events and perform it’s own scrolling.

3. What method is used to specify a container’s layout?

The setLayout() method is used to specify a container’s layout.