0% found this document useful (0 votes)
61 views

Inputstream/Outputstream Class Hierarchy?

The document discusses various aspects of applets and Java GUI programming including: - The Panel, Canvas, Frame, and Applet classes support painting. The Window, Frame, Dialog, FileDialog, Panel, Applet, and ScrollPane are container classes. - The ObjectInputStream class allows reading objects from input streams. The EventObject class and EventListener interface support event handling. - A Frame extends Window to define a main application window with a menu bar, while a Window is the base class for all top-level windows. - Reader/Writer are for character streams while InputStream/OutputStream are for byte streams.

Uploaded by

Tanvi Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

Inputstream/Outputstream Class Hierarchy?

The document discusses various aspects of applets and Java GUI programming including: - The Panel, Canvas, Frame, and Applet classes support painting. The Window, Frame, Dialog, FileDialog, Panel, Applet, and ScrollPane are container classes. - The ObjectInputStream class allows reading objects from input streams. The EventObject class and EventListener interface support event handling. - A Frame extends Window to define a main application window with a menu bar, while a Window is the base class for all top-level windows. - Reader/Writer are for character streams while InputStream/OutputStream are for byte streams.

Uploaded by

Tanvi Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 4

1. What is the immediate superclass of the Applet class?

Panel
2. Name three Component subclasses that support painting.
The Canvas, Frame, Panel, and Applet classes support painting.
3. Name four Container classes.
Window, Frame, Dialog, FileDialog, Panel, Applet, or ScrollPane
4. What class allows you to read objects directly from a stream?
The ObjectInputStream class supports the reading of objects from input
streams.
5. Which java.util classes and interfaces support event handling?
The EventObject class and the EventListener interface support event
processing.
6. 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.
*7.What is the difference between the Reader/Writer class hierarchy and
the
InputStream/OutputStream class hierarchy?
The Reader/Writer class hierarchy is character-oriented,
InputStream/OutputStream class hierarchy is byte-oriented.
8.Life cycle of an applet includes which steps?
Life cycle involves the following steps

Initialization

Starting

Stopping

Destroying

Painting

9. What is the role of init method under applets?

and

the

It initializes the applet and is the first method to be called.


10. Which method is called by Applet class to load an image?
getImageURLobject, filename is used for this purpose.
11. An applet extend which class?
An applet extends java.applet.Applet class
12. are AWT components heavyweight or light weight?
heavyweight: Heavy weight components depend on the local windowing
toolkit
13. What is an Applet with a example?
It is a small program which is easily transmitted over internet Applet can
be downloaded whenever a user demand It makes some of the functionality
to be move from server to client It is installed automatically It has limited
access of resources It run as a part of web document Lesser risk of viruses
Applet intract with the user through AWT(abstract window toolkit) not with I/O
Small example to draw a string using applet :
import java.awt.*;
import java.applet.*;
public class SimpleApplet extends Applet {
public void paint(Graphics g) {
g.drawString("A Simple Applet", 20, 20);
}
}
14. What are the component and container classes?
A component is a graphical object. A few examples of components are:
Button Canvas
TextComponent

Checkbox

Choice

Container

Label

List

Scrollbar

-public class Container extends Component and is a component that can


contain other AWT components.
A few examples of are:

BasicSplitPaneDivider
Box
CellRendererPane
DefaultTreeCellEditor.EditorContainer JComponent Panel ScrollPane Window
15. Applets cannot perform actions such as reading/writing to the file
system
16. How does applet differ from applications? Applets cannot perform
actions such as reading/writing to the file system. Java applications run
standalone, outside the browser.
17. name some attributes of Applet tags?
height: Defines height of applet
width: Defines width of applet
align: Defines the text alignment around the applet
alt: An alternate text to be displayed if the browser support applets but
cannot run this applet
archive: A URL to the applet when it is stored in a Java Archive or ZIP file
code: A URL that points to the class of the applet
codebase: Indicates the base URL of the applet if the code attribute is relative
hspace: Defines the horizontal spacing around the applet
vspace: Defines the vertical spacing around the applet
name: Defines a name for an applet
object: Defines the resource name that contains a serialized representation of
the applet
title: Display information in tool ti
18. Explain how to set the background color within the applet area
You can set the background color of an applet in the following manner:
<applet code="MyApplet.class" width="100" height="100">
<param name="background-color" value="#ffffff">
<param name="foreground-color" value="#000000">
</applet>

You might also like