Most Important Frequently Asked Awt (abstract Window Toolkit) Interview Questions
-
Question 1. What Are Awt Peers?
Answer :
A component is associated with a standard AWT button object, a peer object and an interfacing button object constructed per the native GUI.
-
Question 2. What Is The Difference Between A Swing And Awt Components?
Answer :
- AWT components re heavy weight, whereas Swing components are lightweight.
- 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.
Java Script Interview Questions -
Question 3. What Are The Different Types Of Controls In Awt?
Answer :
The AWT supports the following types of controls:
- Labels, Pushbuttons, Checkboxes, Choice lists, Lists, Scroll bars, Text components
- These controls are subclasses of component.
-
Question 4. What Are The Benefits Of Swing Over Awt?
Answer :
- Swing components are light weight.
- We can have a pluggable look and feel feature which shows us how they appear in other platforms.
- We can add images to Swing components. We have toolbars and tooltips in Swing.
Java Script Tutorial -
Question 5. What Are The Component And Container Class?
Answer :
A component is a graphical object.
A few examples of components are:
- Button
- Canvas
- Checkbox
- Choice etc.
JavaServer Faces (JSF) Interview Questions -
Question 6. What Is The Use Of The Window Class?
Answer :
- The window class can be used to create a plain, bare bones window that does not have a border or menu.
- The window class can also be used to display introduction or welcome screens.
-
Answer :
Clipping is the process of confining paint operations to a limited area or shape.
JavaServer Faces (JSF) Tutorial Java Swing Interview Questions -
Question 8. What Is The Parameter Specification For The Public Static Void Main Method?
Answer :
- String args []
- String [] args
-
Question 9. What Is The Difference Between The Paint() And Repaint() Method?
Answer :
- The paint() method supports painting via a Graphics object.
- The repaint() method is used o cause paint() to be invoked by the AWT painting thread.
Java applet Interview Questions -
Question 10. What Interface Is Extended By Awt Event Listener?
Answer :
The java.util.EventListener interface is extended by all the AWT event listeners.
Java Swing Tutorial -
Question 11. What Is A Container In A Gui?
Answer :
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.
Java Interview Questions -
Question 12. What Is The Default Layout For Applet?
Answer :
The default layout manager for an Applet is FlowLayout, and the FlowLayout manager attempts to honor the preferred size of any components.
Java Script Interview Questions -
Question 13. Name Components Subclasses That Support Painting?
Answer :
- The Canvas
- Frame
- Panel and
- Applet classes support painting
Java Tutorial -
Question 14. What Is The Difference Between A Menuitem And A Checkboxmenuitem?
Answer :
The CheckboxMenuItem class extends the MenuItem class to support a menu item that may be checked or unchecked.
-
Question 15. How Are The Elements Of Different Layouts Organized?
Answer :
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.
JavaMail API Interview Questions -
Question 16. What Is The Difference Between Grid And Gridbaglayout?
Answer :
In Grid layout the size of each grid is constant where as in GridbagLayout grid size can varied.
JavaMail API Tutorial -
Question 17. What Is A Layout Manager?
Answer :
A layout manager is an object that is used to organize components in a container.
Java 8 Interview Questions -
Question 18. Where The Cardlayout Is Used?
Answer :
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.
JavaServer Faces (JSF) Interview Questions -
Question 19. Which Container May Contain A Menu Bar?
Answer :
Frame
Java 8 Tutorial -
Question 20. What Are The Types Of Checkboxes?
Answer :
Java supports two types of checkboxes.
They are:
- Exclusive and
- Non exclusive
JSON (JavaScript Object Notation) Interview Questions -
Question 21. What Is The Difference Between Exclusive And Non Exclusive?
Answer :
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.
-
Question 22. What Is Paint Method?
Answer :
The AWT uses a Callback mechanism for painting which is the same for heavyweight and lightweight components.
JSON (JavaScript Object Notation) Tutorial -
Question 23. What Is The Purpose Of Repaint Method?
Answer :
repaint() requests can erase and redraw (update) after a small time display. When you invoke repaint().
The Java Debugger (JDB) Interview Questions -
Question 24. Which Containers Use A Border Layout As Their Default Layout?
Answer :
Window Frame and Dialog classes use a Border Layout as their layout.
Java Swing Interview Questions -
Question 25. What Is Meant By Controls?
Answer :
Controls are components that allow a user to interact with your application.
The Java Debugger (JDB) Tutorial -
Question 26. What Is The Difference Between Choice And List?
Answer :
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.
JFace Interview Questions -
Question 27. 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.
Java applet Interview Questions -
Question 28. What Are The Subclasses Of The Container Class?
Answer :
The container class has three major subclasses.
They are:
- Window
- Panel
- ScrollPane
-
Question 29. Which Method Is Method To Set The Layout Of A Container?
Answer :
setLayout ()
-
Question 30. What Are The Default Layouts For A Applet, A Frame And A Panel?
Answer :
For an applet and a panel, Flow layout, and The FlowLayout manager attempts to honor the preferred size of any components.
-
Question 31. What Is The Difference Between A Scrollbar And A Scrollpane?
Answer :
- 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.
-
Question 32. Which Method Will Cause A Frame To Be Displayed?
Answer :
- .show()
- .setVisible()
-
Question 33. How Can We Get All Public Methods Of An Object Dynamically?
Answer :
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.
Java Interview Questions -
Question 34. Which Component Subclass S Used For Drawing And Painting?
Answer :
Canvas
-
Answer :
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.
-
Question 36. Explain The Use Of Update Method?
Answer :
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.
JavaMail API Interview Questions -
Question 37. Which Containers Use A Flowlayout As Their Default Layout?
Answer :
The Panel and the Applet classes use the Flow Layout as their default layout.
-
Question 38. What Are The Subclass Of Textcomponent Class?
Answer :
TextField and TextArea
Topic: Awt (abstract Window Toolkit) Interview Questions
No comments:
Post a Comment