Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Intermediate
Jan 12, 2000

Change the Gray Applet Background

Applets use a default background of gray, which may not be visually appealing to you. Besides, gray may be the background color of the web page on which the applet is loaded.

One way to change the applet's background is to repaint the background in the paint() method of the applet. But, if you wanted to change the applet's background as soon as the applet loads, the best place would be in the init() method, and the applet will change color once it's loaded, as in the following:

 
public void init() 
{ 
setBackground ( Color.black ); 
//rest of the init() code 
} 
Behrouz Fallahi
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap