Basic Abstract Window Toolkit (AWT) Interview Preparation Guide
Download PDF

AWT Interview Questions and Answers will guide us now that Abstract Window Toolkit (AWT) is Javas original platform-independent windowing, graphics, and user-interface widget toolkit. The AWT is now part of the Java Foundation Classes (JFC) - the standard API for providing a graphical user interface (GUI) for a Java program. Lean AWT or get preparation for the job of AWT with the help of this Abstract Window Toolkit (AWT) Interview Questions and Answers

41 AWT Questions and Answers:

Table of Contents:

Basic  AWT Job Interview Questions and Answers
Basic AWT Job Interview Questions and Answers

1 :: What is the JFC?

JFC stands for Java Foundation Classes. The Java Foundation Classes (JFC) are a set of Java class libraries provided as part of Java 2 Platform, Standard Edition (J2SE) to support building graphics user interface (GUI) and graphics functionality for client applications that will run on popular platforms such as Microsoft Windows, Linux, and Mac OSX.

2 :: What is an event?

Changing the state of an object is called an event.

4 :: What are the advantages of the event-delegation model over the event-inheritance model?

Event-delegation model has two advantages over event-inheritance model. a)Event delegation model enables event handling by objects other than the ones that generate the events. This allows a clean separation between a component's design and its use. b)It performs much better in applications where many events are generated. This performance improvement is due to event-delegation model does not have to be repeatedly process unhandled events as is the case of the event-inheritance.

5 :: What is controls and what are different types of controls in AWT?

Controls are components that allow a user to interact with your application. AWT supports the following types of controls: Labels, Push Buttons, Check Boxes, Choice Lists, Lists, Scrollbars, Text Components. These controls are subclasses of Component.

6 :: What is the difference between scrollbar and scrollpane?

A Scrollbar is a Component, but not a Container whereas Scrollpane is a Container and handles its own events and perform its own scrolling.

7 :: How are the elements of different layouts organized?

The elements of a FlowLayout are organized in a top to bottom, left to right fashion. The elements of a BorderLayout are organized at the borders (North, South, East and West) and the center of a container. The elements of a CardLayout are stacked, on top of the other, like a deck of cards. The elements of a GridLayout are of equal size and are laid out using the square of a grid. 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. It is the most flexible layout.

8 :: What are the restrictions imposed by a Security Manager on Applets?

Applets cannot read or write files on the client machine that's executing it. They cannot load libraries or access native libraries. They cannot make network connections except to the host that it came from. They cannot start any program on the client machine. They cannot read certain system properties. Windows that an applet brings up look different than windows that an application brings up.

9 :: What is the relationship between an event-listener interface and an event-adapter class?

An event-listener interface defines the methods that must be implemented by an event handler for a particular kind of event. An event adapter provides a default implementation of an event-listener interface.

10 :: What is the difference between the paint() and repaint() methods?

The paint() method supports painting via a Graphics object. The repaint() method is used to cause paint() to be invoked by the AWT painting thread.

11 :: What is Canvas?

Canvas is a Component subclass which is used for drawing and painting. Canvas is a rectangular area where the application can draw or trap input events.

12 :: What are the features of JFC?

Pluggable Look-and-Feel, Accessibility API, Java 2D API, Drag and Drop Support.

13 :: What are invisible components?

They are light weight components that perform no painting, but can take space in the GUI. This is mainly used for layout management.

14 :: What does Realized mean?

Realized mean that the component has been painted on screen or that is ready to be painted. Realization can take place by invoking any of these methods. setVisible(true), show() or pack().

15 :: Why does JComponent class have add() and remove() methods but Component class does not?

JComponent is a subclass of Container and can contain other components and JComponents.

16 :: What is the difference between AWT and SWT?

SWT (Standard Widget Toolkit) is a completely independent Graphical User Interface (GUI) toolkit from IBM. They created it for the creation of Eclipse Integrated Development Environment (IDE). AWT is from Sun Microsystems.

17 :: What is a convertor?

Converter is an application that converts distance measurements between metric and U.S units.

18 :: What is the purpose of the enableEvents() method?

The enableEvents() method is used to enable an event for a particular object. Normally, an event is enabled when a listener is added to an object for a particular event. The enableEvents() method is used by objects that handle events by overriding their event-dispatch methods.

19 :: Which is the super class of all event classes?

The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy.

20 :: 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. A window can be modal.

21 :: What advantage do Javas layout managers provide over traditional windowing systems?

Java uses layout managers to lay out components in a consistent manner across all windowing platforms. Since Java's layout managers aren't tied to absolute sizing and positioning, they are able to accommodate platform-specific differences among windowing systems.

22 :: When should the method invokeLater() be used?

This method is used to ensure that Swing components are updated through the event-dispatching thread.

23 :: What is the relationship between clipping and repainting?

When a window is repainted by the AWT painting thread, it sets the clipping regions to the area of the window that requires repainting.
A Canvas object provides access to a Graphics object via its paint() method.

25 :: 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.
AWT Interview Questions and Answers
41 AWT Interview Questions and Answers