Saturday, May 10, 2008

Java Interview Questions 50

246. What is meant by controls and what are different types of controls in AWT?-
Controls are components that allow a user to interact with your application and the
AWT supports the following types of controls: Labels, Push Buttons, Check Boxes,
Choice Lists, Lists, Scrollbars, Text Components. These controls are subclasses of
Component.

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

248. What is the difference between scrollbar and scrollpane?- A Scrollbar is a
Component, but not a Container whereas Scrollpane is a Conatiner and handles its
own events and perform its own scrolling.

249. What is a layout manager and what are different types of layout managers
available in java AWT?- A layout manager is an object that is used to organize
components in a container. The different layouts are available are FlowLayout,
BorderLayout, CardLayout, GridLayout and GridBagLayout.

250. How are the elements of different layouts organized?- 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 are laid out using the square of a
grid. GridBagLayout: The elements of a GridBagLayout are organized according to a
grid. However, the elements are of different size and may occupy more than one row
or column of the grid. In addition, the rows and columns may have different sizes.

No comments:

Useful Information