There are six special attributes that can be used for customizing the applet window during downloading of an applet. (Note: The same applies to a JavaBeans component.) This section discusses:
Note:These attributes currently work only with Netscape browsers. In the future they will be made to work with Internet Explorer as well. |
When none of these tags are used, the default appearance of the applet window is as follows:
The animated coffee cup logo is placed in the upper left corner. Its dimensions
are 24x24 pixels and it is located 6 pixels from the top and left sides of the
applet window. If the entire size of the applet is less than 36x36 pixels, then
it will not be displayed. The status bar will display "Loading Java content...
"
when the mouse points at the applet window.
image
The image
attribute allows you to replace the default coffee cup
logo with a custom graphic. The format with the standard APPLET
element is:
<APPLET ...>
<PARAM name="image" = value="my_image.gif">
</APPLET>
See Using OBJECT
, EMBED
and APPLET
Tags in Java Plug-in for how this would be mapped
to the OBJECT
or the EMBED
tags.
If a custom graphic is specified, it should be the same size as the area of the applet window. If these sizes do not match, the graphic will be placed in the upper left corner of the area specified for applet. If it is larger than the applet window, part of it will get chopped off. If it is smaller than the applet window, white space will appear around it.
The image can be either a GIF or JPEG, and it should reside in the same directory
where other resources for the applet reside; i.e., if the applet uses the codebase
attribute, then this image should be in the codebase
directory.
Note: The image file should not be in a packaged in a jar file with other applet resources, since the image needs to be displayed while downloading resources.
The status bar will display "Loading Java content...
" when the
mouse is pointed at the applet window.
progressbar
With the progressbar
attribute you can request display of a progress
bar instead of the default graphic. The progress bar will horizontally fill
the applet window up to 6 pixels to the right and left. The text "Loading
Java content...
" will appear above the progress bar and be left-aligned
with it. By default the progress bar is purple. The format for turning on the
progress bar with the standard APPLET
element is:
<APPLET ...>
<PARAM name="progressbar" value="true">
</APPLET>
The status bar will display "Loading Java content...
" when the
mouse is pointed at the applet window.
boxmessage
With the boxmessage
attribute you can customize the text that
is displayed. If you use this attribute, the text will be used with the progress
bar and with the status bar. The format for using this with the standard APPLET
element is:
<APPLET ...>
<PARAM name="boxmessage" value="<your custom message goes here">
</APPLET>
boxcolor, boxfgcolor, progresscolor
These attributes can be used to customize colors in the applet window.
By default the applet window background color is gray. The attribute boxcolor
can be used to specify a different background color. The format for use with
the standard APPLET
element is:
<APPLET ...>
<PARAM name="boxcolor" value="<value>">
</APPLET>
where <value>
may be:
Color
from java.awt.Color
, or r,g,b
where r
, g
, and b
are integers in the range of 0-255
that would render an opaque
standared RGB (sRGB) color in the Color
constructor Color(int
r, int g, int b)
.Examples: value="cyan"
, value="111,222,145"
,
value="33FF33"
By default the applet window foreground color is black. (The applet window
foreground color is used for messages that appear in the window and for the
border of the progress bar.) The attribute boxfgcolor
can
be used to specify a different foreground color. The color values are the same
as described above.
By default the progress bar fill color is purple. The attribute progresscolor
can be used to specify a different fill color. The color values are the same
as described above.
The order of precedence for these attributes is as follows:
1) If no parameters are provided, the default appearance
described above is used.
2) If a custom graphic is specified via the image
attribute, then
the custom graphic will appear as described above under image
.
3) If a progress bar is requested via the progressbar
attribute,
then the progress bar is displayed with the default text and color as described
above under progressbar
.
4) If custom text is provided via the boxmessage
attribute, then
the progress bar is displayed with the custom text as described above under
boxmessage
.
With any combination of image
, progressbar
, and boxmessage
attributes, custom colors can always be provided via the boxcolor
,
boxfgcolor
, and progresscolor
attributes.
If an applet does not download or run cleanly, the applet window will displays error information. The applet window will have a single pixel border using the foreground color, and a small "broken" graphic will occupy the upper left corner. The user can right-mouse click over the applet window to get a popup menu with an option to open the Java Console.