When using JColorChooser.showDialog
with colorTransparencySelectionEnabled=false
in Java 21 on macOS, RGB values in the range 0-64 are rounded down by 1 (e.g., 51/51/51/255
→ 50/50/50/255
), and values in 65-127 show inconsistent rounding (odd values match, even values are decremented by 1). This issue does not occur when colorTransparencySelectionEnabled=true
or when using JColorChooser.createDialog
with explicit JColorChooser
instance management and the sequence of setColorTransparencySelectionEnabled(false)
followed by setColor
.
This document describes the issue, provides steps to reproduce, and outlines a workaround.
- Java: 21.0.7 LTS
- OS: macOS