myCheckbox.setBorder(new LineBorder(Color.red, 2));
When you use the above code to add a Border to a JCheckBox your border will more than likely not display. Reason being that JCheckBox sets the UI property borderPainted to false.
To have the border displayed you need to explicitly tell the JCheckBox to paint it’s border using the following call
Leave a Reply
You must be logged in to post a comment.