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:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: April 14, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles