Here you can find the source of getIconCheckBox(String iconPath, String pressIconPath, String rolloverIconPath, String selectedIconPath)
public static JCheckBox getIconCheckBox(String iconPath, String pressIconPath, String rolloverIconPath, String selectedIconPath)
//package com.java2s; //License from project: Apache License import javax.swing.ImageIcon; import javax.swing.JCheckBox; public class Main { public static JCheckBox getIconCheckBox(String iconPath, String pressIconPath, String rolloverIconPath, String selectedIconPath) { JCheckBox checkBox = new JCheckBox(); checkBox.setIcon(new ImageIcon(iconPath)); checkBox.setPressedIcon(new ImageIcon(pressIconPath)); checkBox.setRolloverIcon(new ImageIcon(rolloverIconPath)); checkBox.setSelectedIcon(new ImageIcon(selectedIconPath)); checkBox.setBorder(null);//from ww w .ja va2s .c o m checkBox.setFocusPainted(false); checkBox.setContentAreaFilled(false); return checkBox; } }