Mega Code Archive

 
Categories / Java Tutorial / Swing
 

Display an icon when the cursor is moved over the checkbox This is called the rollover icon

import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JCheckBox; public class Main {   public static void main(String[] argv) throws Exception {     JCheckBox checkbox = new JCheckBox();     Icon rollIcon = new ImageIcon("roll-icon.gif");     checkbox.setRolloverIcon(rollIcon);   } }