This section shows you how to customize the icon in a check box component. That means any icon can be shown where the checked or unchecked box of the check box is situated. The specified icon is looked with the given text for the check box. Image for the pictorial representation is as follows:

Following is the method used in this program:
setIcon(Icon):
This is the method of the JCheckBox class which sets the icon in the check
box component of swing. The icon is passed to the setIcon() method as a
parameter. The image for icon is specified in the ImageIcon() constructor of the
ImageIcon class. This constructor has been used in this program to create
the instance of the Icon class for specifying the image name.
Here is the code of the program:
import javax.swing.*;
|
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Customize the Icon in a JCheckBox Component of Java Swing
Post your Comment