This section shows you how to customize the icon in a check box component.This section shows you how to customize the icon in a check box component.
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:
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: