An applet can output a message to the status window of the browser or applet viewer on which it is running. For this, it makes a call to showStatus( ) with the string that we want to be displayed. The status window is a place where the user can give feedback about what is occurring in the applet, suggest options, or report some types of errors. The status window also makes an excellent debugging aid, because it gives an easy way to output information about the applet. The applet below shows the use of showStatus( ):
import java.awt.*;
import java.applet.*;
/*
<applet code="StatusWindow" width=300 height=50> </applet>
*/
public class StatusWindow extends Applet
{
public void init()
{
setBackground(Color.pink);
}
public void paint (Graphics g)
{
g.drawString("You are in main applet window.", 10, 20);
showStatus("This is the status window.");
}
}
The output of the above Applet code is as follows: