2.swing Imp Questions
2.swing Imp Questions
Question: 1
FlowLayout: The elements of a FlowLayout are organized in a top to bottom, left to right
fashion.
BorderLayout: The elements of a BorderLayout are organized at the borders(North, South East
and West) and the center of a container.
CardLayout: The elements of a CardLayout are stacked, on top of the other, like a deck of
cards.
GridLayout: The elements of a GridLayout are of equal size and laid out using the square of a
grid.
Question: 2
Question: 3
Since Java’s layout managers aren’t tied to absolute sizing and positioning, they are able to
accommodate platform specific differences among windowing systems.
Question: 4
Question: 5
Question: 6
Question: 7
All components in Swing, except JApplet, JDialog, JFrame and JWindow are lightweight
components.
Question: 8
Name Container classes?
Window,
Frame,
Dialog,
FileDialog,
Panel,
Applet or ScrollPane.
Question: 9
Question: 10
You will get a bonus point if you able to highlight that time consuming operations like
connecting to database, opening a file or connecting to network should not be done on EDT
thread because it could lead to freezing GUI because of blocking and time consuming nature of
these operations instead they should be done on separate thread and EDT can just be used o
spawn those thread on a button click or mouse click.
Question: 2
AWT component are considered to be heavyweight while Swing component are lightweights.
AWT is platform dependent same GUI will look different platform while Swing is developed in
Java and is platform dependent.
Question: 3
Question: 4
The repaint() method is used to cause paint() to be invoked by the AWT painting thread.
Question: 5