devxlogo

Change the Gray Applet Background

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 } 
See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist