violetlib/vaqua

JRadioButton behaves unexpected

Closed this issue · 5 comments

I was really glad when I stumbled about VAqua. I regretted when QuaQua wasn't maintained further so I was greedy to give it a try. Unfortunately I nearly immediately stumbled over the following issue. I use JRadioButtons with Images for the selected/unselected state which looks on Linux/Win/Mac and with System, Metal, Nimbus, Quaqua, FlatLaf, Substance, Jyloo like this (here System):
System

With VAqua and the default it looks like this:

VAqua_default

when I use btn.putClientProperty("JButton.buttonType", "icon"); it shows animated borders but no image:
VAqua_icon

Do you have any suggestion? I would love to use Vaqua.

I tested it with 10.13 and Java 8 but can test it with 10.14/15 11 and Java 11 or 16 if you wish.

Wow, what a fast answer, thanks a lot. I Just checked it. I was astonished that the source of the JRadioButton has no real additional functionality compared to JTogglebutton, so I thought that might work but it looked ugly first:
withToggleButton

With
btn.setFocusable(false);
btn.setBorder(javax.swing.BorderFactory.createEmptyBorder());
I get rid of the unwanted focus indicator and the unwanted border so this worked as wanted. Thanks a lot.

"The problem might have arisen if you changed the look and feel while the program was running?"
I load VaQua at runtime. On Linux/Windows changing the L&F belonged always to the program. To support dark mode I want to give the MacOS user the choice too.

"The focus ring is not painted using a border, so it should not be necessary to set the border, but it doesn’t hurt to do so."
For whatever reason I see the border around the icon only Togglebutton, but no issue, setting an empty border looks as expected.

I had two crashes in native code, but can't reproduce it anymore. Maybe it's helpful so I attached the hs_err_pid files
hs_err_pid10060.log
hs_err_pid10952.log