Here, we will learn about making the banner in java applet. Simply the banner is used to advertising for any institution, shops and any organizations. The advertising can be done by the different - different ways but the main aim is to popular our organization. For more popularity. But here, we will see what is a banner in the computer manner. As we know that the displaying detailed information in the graphics format on the page is known as banner. In other words, the banner is a collection of graphics and texts. With the help of banner we easily make to understand about the things.
In this program we will see how to display the banner in applet. This example has been used to display the simple text rotation in a rectangular area of the appropriate applet to understand that what is the banner and how to use that. There are four types of method have been used in this program these are explained below one by one :
This is the init() method which is the first method of the life cycle of an applet has been used to set the Background and Foreground colors of the banner.
This is the start() method which is the second method of the life cycle of an applet has been used to create and start a thread.
This is the run() method which has been used to set the time interval for the created thread. That means the rotation of text to be rotate on how much time.
And finally this is the paint() method which has been used to draw the rectangle, set it's color and display the moving text in the appropriate rectangle.
Here is the Java code:
Here is the HTML code:
<APPLET CODE = "SampleBanner" WIDTH = "500" HEIGHT = "300"></APPLET>
Recommend the tutorial