Java Interview Questions On Applet and Swing |
17. What is the difference between a Window and a Frame?
Answer
The Frame class extends Window to define a main application window that can
have a menu bar.
|
18. What is the relationship between the Canvas class and the Graphics class?
Answer
A Canvas object provides access to a Graphics object via its paint() method |
19. Which TextComponent method is used to set a TextComponent to the read-only
state?
Answer
setEditable() |
20. How are the elements of a CardLayout organized?
Answer
The elements of a CardLayout are stacked, one on top of the other, like a deck
of cards
|
21. What is the relationship between clipping and repainting?
Answer
When a window is repainted by the AWT painting thread, it sets the clipping
regions to the area of the window that requires repainting.
|
22. What is the preferred size of a component?
Answer
The preferred size of a component is the minimum component size that will allow the component to display normally. |
23. What method is used to specify a container's layout?
Answer
The setLayout() method is used to specify a container's layout. |
24. Which containers use a FlowLayout as their default layout?
Answer
The Panel and Applet classes use the FlowLayout as their default layout. |