How to give JCheckBox a feel of Button?
JCheckBox doesn't look like a JButton. Yes, of course, I do agree. But did you remember that JCheckBox is after all a sub-class of the AbstractButton and that this beautiful class has the setBorderPainted() with which we can play and do the thing like a mad kid?
class JCheckBoxButton extends JFrame
private void createAndShowGUI()
setTitle("JCheckBox Content Area Filled");
jc=new JCheckBox("Check/Uncheck me");
// Quite big
// Make it quite broad
// Set border painted!!
// Focus shouldn't be painted
// Set foreground, background
// Add JCheckBox
public static void main(String args)
The greatest compliment you can give me is when you share this with others. I sincerely appreciate it :)
“Let there be no purpose in friendship save the deepening of the spirit.” - Kahlil Gibran