Real Time AWT (Abstract Window Toolkit) Interview Questions and Answers PDF
• What Are Awt Peers?
A component is associated with a standard AWT button object, a peer object and an interfacing button object constructed per the native GUI.
• What Is The Difference Between A Swing And Awt Components?
o AWT components re heavy weight, whereas Swing components are lightweight.
o Heavy weight components depend on the local windowing toolkit.
For example, java.awt.Button is a heavy weight component, when it is running on the Java platform for Unix platform, it maps to a real Motif button.
• What Are The Different Types Of Controls In Awt?
The AWT supports the following types of controls:
o Labels, Pushbuttons, Checkboxes, Choice lists, Lists, Scroll bars, Text components
o These controls are subclasses of component.
• What Are The Benefits Of Swing Over Awt?
o Swing components are light weight.
o We can have a pluggable look and feel feature which shows us how they appear in other platforms.
o We can add images to Swing components. We have toolbars and tooltips in Swing.
• What Are The Component And Container Class?
A component is a graphical object.
A few examples of components are:
o Button
o Canvas
o Checkbox
o Choice etc.
• What Is The Use Of The Window Class?
o The window class can be used to create a plain, bare bones window that does not have a border or menu.
o The window class can also be used to display introduction or welcome screens.
• What Is Clipping?
Clipping is the process of confining paint operations to a limited area or shape.
• What Is The Parameter Specification For The Public Static Void Main Method?
o String args []
o String [] args
• What Is The Difference Between The Paint() And Repaint() Method?
o The paint() method supports painting via a Graphics object.
o The repaint() method is used o cause paint() to be invoked by the AWT painting thread.
• What Interface Is Extended By Awt Event Listener?
The java.util.EventListener interface is extended by all the AWT event listeners.
• What Is A Container In A Gui?
A Container contains and arranges other components through the use of layout managers, which use specific layout policies to determine where components should go as a function of the size of the container.
• What Is The Default Layout For Applet?
The default layout manager for an Applet is FlowLayout, and the FlowLayout manager attempts to honor the preferred size of any components.
• Name Components Subclasses That Support Painting?
o The Canvas
o Frame
o Panel and
o Applet classes support painting
• What Is The Difference Between A Menuitem And A Checkboxmenuitem?
The CheckboxMenuItem class extends the MenuItem class to support a menu item that may be checked or unchecked.
• 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.
Border Layout: The elements of a BorderLayout are organized at the borders and the centre of a container.
CardLayout: The elements of a CardLayout are stacked, on the top of the other, like a deck of cards.
GridLayout: The elements of a GridLayout are equal size and are laid out using the square of a grid.
GridBagLayout: The elements of a GridBagLayout are organized according to a grid.
• What Is The Difference Between Grid And Gridbaglayout?
In Grid layout the size of each grid is constant where as in GridbagLayout grid size can varied.
• What Is A Layout Manager?
A layout manager is an object that is used to organize components in a container.
• Where The Cardlayout Is Used?
CardLayout is used where we need to have a bunch of panel or frames one laying over another. It is replaced by TabbedPane in Swing.
• Which Container May Contain A Menu Bar?
Frame
• What Are The Types Of Checkboxes?
Java supports two types of checkboxes.
They are:
o Exclusive and
o Non exclusive
• What Is The Difference Between Exclusive And Non Exclusive?
Exclusive: Only one among a group of items can be selected at a time. If an item from the group is selected, the checkbox currently checked is deselected and the new selection is highlighted. The exclusive Checkboxes are also called as Radio buttons.
Non Exclusive: Checkboxes are not grouped together and each one can be selected of the other.
• What Is Paint Method?
The AWT uses a Callback mechanism for painting which is the same for heavyweight and lightweight components.
• What Is The Purpose Of Repaint Method?
repaint() requests can erase and redraw (update) after a small time display. When you invoke repaint().
• Which Containers Use A Border Layout As Their Default Layout?
Window Frame and Dialog classes use a Border Layout as their layout.
• What Is Meant By Controls?
Controls are components that allow a user to interact with your application.
• What Is The Difference Between Choice And List?
A choice is displayed in a compact from 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.
• What Is The Difference Between A Window And A Frame?
The Frame class extends Window to define a main application window that can have a menu bar.
• What Are The Subclasses Of The Container Class?
The container class has three major subclasses.
They are:
o Window
o Panel
o ScrollPane
• Which Method Is Method To Set The Layout Of A Container?
setLayout ()
• What Are The Default Layouts For A Applet, A Frame And A Panel?
For an applet and a panel, Flow layout, and The FlowLayout manager attempts to honor the preferred size of any components.
• What Is The Difference Between A Scrollbar And A Scrollpane?
o A Scrollbar is a component, but not a container.
o A Scrollpane is a container.
o A Scrollpane handles its own events and performs its own scrolling.
• Which Method Will Cause A Frame To Be Displayed?
o .show()
o .setVisible()
• How Can We Get All Public Methods Of An Object Dynamically?
getMethods(): It return an array of method objects corresponding to the public methods of this class.
getFields(): It returns an array of Field objects corresponding to the public Fields (variables) of this class.
getConstructors: It returns an array of constructor objects corresponding to the public constructors of this class.
• Which Component Subclass S Used For Drawing And Painting?
Canvas
• Define Canvas?
It is a simple drawing surface which is used for painting images or to perform other graphical operations.
What is the difference between the Font and FontMetrics classes?
The FontMetrics class is used to define implementation specific properties such as ascent and descent, of a Font object.
• Explain The Use Of Update Method?
An update method is called on calling the repaint method.
The default implementation of the update() method clears the screen and calls the paint() method.
• Which Containers Use A Flowlayout As Their Default Layout?
The Panel and the Applet classes use the Flow Layout as their default layout
• What Are The Subclass Of Textcomponent Class?
TextField and TextArea
No comments:
Post a Comment