| 31 |
Q |
How are the elements of different
layouts organized? |
| |
A |
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. |
| |
|
|
| 32 |
Q |
What are types of applets? |
| |
A |
There are two different types of applets.
Trusted Applets and Untrusted applets.
Trusted Applets are applets with predefined security and
Untrusted Applets are applets without any security. |
| |
|
|
| 33 |
Q |
What are the restrictions
imposed by a Security Manager on Applets? |
| |
A |
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. |
| |
|
|
| 34 |
Q |
What is the difference between the
Font and FontMetrics classes? |
| |
A |
The FontMetrics class is used to define
implementation-specific properties, such as ascent and
descent, of a Font object. |
| |
|
|
| 35 |
Q |
What is the relationship between an
event-listener interface and an event-adapter class? |
| |
A |
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. |
| |
|
|
| 36 |
Q |
How can a GUI component handle its
own events? |
| |
A |
A component can handle its own events by implementing
the required event-listener interface and adding itself as
its own event listener. |
| |
|
|
| 37 |
Q |
What is the difference between the
paint() and repaint() methods? |
| |
A |
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. |
| |
|
|
| 38 |
Q |
What interface is extended by AWT
event listeners? |
| |
A |
All AWT event listeners extend the
java.util.EventListener interface. |
| |
|
|
| 39 |
Q |
What is Canvas ? |
| |
A |
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. |
| |
|
|
| 40 |
Q |
What is default Look-and-Feel of a
Swing Component? |
| |
A |
Java Look-and-Feel. |
| |
|
|
| 41 |
Q |
What are the features of JFC? |
| |
A |
Pluggable Look-and-Feel, Accessibility API, Java 2D API,
Drag and Drop Support. |
| |
|
|
| 42 |
Q |
What does x mean in javax.swing? |
| |
A |
Extension of java. |
| |
|
|
| 43 |
Q |
What are invisible components? |
| |
A |
They are light weight components that perform no
painting, but can take space in the GUI. This is mainly used
for layout management. |
| |
|
|
| 44 |
Q |
What is the default layout for a
ContentPane in JFC? |
| |
A |
BorderLayout. |
| |
|
|
| 45 |
Q |
What does Realized mean? |
| |
A |
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(). |