Swings Interview Questions



Q) What is the difference between a Choice and a List?
A)
A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices. Only one item may be selected from a Choice. A List may be displayed in such a way that several List items are visible. A List supports the selection of one or more List items.

Q) What interface is extended by AWT event listeners?
A)
All AWT event listeners extend the java.util.EventListener interface.

Q) What is a layout manager?
A)
A layout manager is an object that is used to organize components in a container.

Q) Which Component subclass is used for drawing and painting?
A)
Canvas

Q) What is the difference between a Scrollbar and a ScrollPane?
A)
A Scrollbar is a Component, but not a Container.A ScrollPane is a Container. A ScrollPane handles its own events and performs its own scrolling.

Q) Which Swing methods are thread-safe?
A)
The only thread-safe methods are repaint(), revalidate(), and invalidate()

Q) Which containers use a border Layout as their default layout?
A)
The Window, Frame and Dialog classes use a border layout as their default layout

Q) What is the preferred size of a component?
A)
The preferred size of a component is the minimum component size that will allow the component to display normally

Q) Which containers use a FlowLayout as their default layout?
A)
The Panel and Applet classes use the FlowLayout as their default layout

Q) What is the immediate superclass of the Applet class?
A)
Panel

Q) Name three Component subclasses that support painting?
A)
The Canvas, Frame, Panel, and Applet classes support painting

Q) What is the immediate superclass of the Dialog class?
A)
Window

Q) What is clipping?
A)
Clipping is the process of confining paint operations to a limited area or shape.

Q) What is the difference between a MenuItem and a CheckboxMenuItem?
A)
The CheckboxMenuItem class extends the MenuItem class to support a menu item that may be checked or unchecked.

Q) What class is the top of the AWT event hierarchy?
A)
The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy

Random Posts

  • What is Abstract Class?Explan
  • Explain Thread-Safe JSP page and there advantages
  • Define HttpSession Class
  • What are Command Line Arguments in Java
  • Example programs of lifecycle of servlets

Post a Comment