1

I'm trying to have JToggleButton buttons that don't have a border normally, and just show the icons I provide. But then when they are clicked, I want the selected button to show.

I know that by using setLayout(null). The initial state works, but then when I click it, the border doesn't show up. There must be some simple border call I'm missing. Does anyone know how to accomplish this?

https://i.stack.imgur.com/6nrW2.png

https://i.stack.imgur.com/6nrW2.png#1

bforcer
  • 147
  • 3
  • 13

1 Answers1

5

Not sure I understand the question but maybe the following will help:

button.setBorderPainted(false);
camickr
  • 321,443
  • 19
  • 166
  • 288
  • That does the same as setting the border to null. See the pics I added for a better visual. – bforcer Jun 19 '13 at 05:51
  • Actually I figued out a way where I have an if state that, if(selected)-BorderPainted(true) else BorderPainted(false). So I guess that works out. Thanks – bforcer Jun 19 '13 at 06:03