by Dinesh Thakur Category: AWT and Applets

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:


                               StatusWindow Output

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content





Popular Article