The setBackground() method is defined by the Component class. It is used to set the background of an applet’s window to a specified color. The syntax of this method declaration is as follows:
Here, new color specifies the color. The Color class defines the constants, which can be used to set the color. Some of them are listed below:
- Color.black
- Color.pink
- Color.green
- Color.yellow
Like this article? Share it with others
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.
