Search code examples
javaswingborderjcheckbox

adding border to jcheckbox


Does anyone know if there is an easy way to put a border around a JCheckBox object including the label? setBorder doesn't seem to have any effect. I know I could put each checkbox inside of a JPanel and border that, but is there no way to border the entire JCheckBox by itself? Thanks


Solution

  • on a jcheckbox the setborder does work, its just that the border is not painted. all you have to do is call setBorderPainted(true) and it should work.