| 46 |
Q |
What is difference between Swing and JSF? |
| |
A |
The key difference is that JSF runs on server. It
needs a server like Tomcat or WebLogic or WebSphere. It displays
HTML to the client. But Swing program is a stand alone
application. |
| |
|
|
| 47 |
Q |
Why does JComponent class have add() and
remove() methods but Component class does not? |
| |
A |
JComponent is a subclass of Container and can contain other
components and JComponents. |
| |
|
|
| 48 |
Q |
What method is used to specify a
container's layout? |
| |
A |
The setLayout() method is used to specify a container's
layout. |
| |
|
|
| 49 |
Q |
What is the difference between AWT and
SWT? |
| |
A |
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. |
| |
|
|
| 50 |
Q |
What is the difference between JFC & WFC? |
| |
A |
JFC supports robust and portable user
interfaces. The Swing classes are robust, compatible with AWT,
and provide you with a great deal of control over a user
interface. Since source code is available, it is relatively easy
to extend the JFC to do exactly what you need it to do. But the
number of third-party controls written for Swing is still
relatively small.
WFC runs only on the Windows (32-bit) user
interface, and uses Microsoft extensions to Java for event
handling and ActiveX integration. Because ActiveX components are
available to WFC programs, there are theoretically more controls
available for WFC than for JFC. In practice, however, most
ActiveX vendors do not actively support WFC, so the number of
controls available for WFC is probably smaller than for JFC. The
WFC programming model is closely aligned with the Windows
platform. |
| |
|
|
| 51 |
Q |
What is a convertor? |
| |
A |
Converter is an application that converts distance
measurements between metric and U.S units. |
| |
|
|
| 52 |
Q |
What is the difference between a Canvas
and a Scroll Pane? |
| |
A |
Canvas is a component. ScrollPane is a container. Canvas is
a rectangular area where the application can draw or trap input
events. ScrollPane implements horizontal and vertical scrolling. |
| |
|
|
| 53 |
Q |
What is the purpose of the enableEvents()
method? |
| |
A |
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. |
| |
|
|
| 54 |
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. |
| |
|
|
| 55 |
Q |
Which is the super class of all event
classes? |
| |
A |
The java.awt.AWTEvent class is the highest-level class in
the AWT event-class hierarchy. |
| |
|
|
| 56 |
Q |
How the Canvas class and the Graphics
class are related? |
| |
A |
A Canvas object provides access to a Graphics object via its
paint() method. |
| |
|
|
| 57 |
Q |
What is the difference between a Window
and a Frame? |
| |
A |
The Frame class extends Window to define a main application
window that can have a menu bar. A window can be modal. |
| |
|
|
| 58 |
Q |
What is the relationship between clipping
and repainting? |
| |
A |
When a window is repainted by the AWT painting thread, it
sets the clipping regions to the area of the window that
requires repainting. |
| |
|
|
| 59 |
Q |
What advantage do Java's layout managers
provide over traditional windowing systems? |
| |
A |
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. |
| |
|
|
| 60 |
Q |
When should the method invokeLater() be
used? |
| |
A |
This method is used to ensure that Swing components are
updated through the event-dispatching thread. |