On Thu, 10 Mar 2022 02:42:00 GMT, Harshitha Onkar <d...@openjdk.java.net> wrote:

> Previously while tabbing through the JTable cell, the cell highlighter/focus 
> ring was not visible against the selection background. 
> 
> Changes are made to Aqua LAF to derive a lighter focus ring color by changing 
> saturation and setting brightness component to 100% of original focus ring 
> color so that it is visible while tabbing through `JTable` cells. A new 
> method is added for this purpose which takes in `focusRingColor`, does 
> adjustment to saturation and brightness and returns a new focus ring color. 
> There are edge cases where the HSB transformation does not yield the right 
> focus ring color, for these cases a default color is returned.
> 
> A test case is added to compare the RGB difference between the original focus 
> ring color & selection background and the new focus ring color & selection 
> background. A note on the test case, since the test case is automated it 
> tests the cell focus ring with colors loaded during the start of program 
> execution and any on-the-fly accent color changes were tested manually.
> 
> **Edge Cases**
> ![image](https://user-images.githubusercontent.com/95945681/161360456-3929acf1-282b-4c2b-95d1-1d5707c1e238.png)
> 
> The edge case condition consists of two parts –
> 
> - To handle white/black colors - (hsbValues[0] == 0 && hsbValues[1] == 0) - 
> representing hue and saturation of zero obtained for black, white or exactly 
> grey (red=green=color) conditions
> 
> 
> - To handle grayish colors - hsbValues[1] <= satGrayScale where satGrayScale 
> <= 0.10 . For any given hue and brightness, a saturation of less than or 
> equal to 10% represents grayish tint colors. (The second case was added to 
> accommodate grayish focus ring color returned by system when Accent color = 
> Graphite.  The returned color is not exactly gray but grayish (r=135, g=135, 
> b=140)). To accommodate a more generic case of grayish colors, the 
> satGrayScale has a threshold or tolerance of 0.10 or 10%. 
> 
> Used the following resources to test out different grayish colors and optimal 
> saturation offsets used in  `deriveLighterFocusRing()`.
> 
> - [RapidTables](https://www.rapidtables.com/convert/color/rgb-to-hsl.html) 
> - [Colorizer](http://colorizer.org/).
> - [Chart Link](https://codepen.io/HunorMarton/details/eWvewo)
> 
> **A note on the system-colors:** 
> 
> _For Mac 10.14 below:_
> [keyboardfocusindicatorcolor](https://developer.apple.com/documentation/appkit/nscolor/1532031-keyboardfocusindicatorcolor)
> Issue: Works well for most of the scenarios (including on-the-fly changes) 
> and follows the accent color changes except when we start the application 
> with accent color set to Graphite and then change accent color on-the-fly The 
> cell focus ring remains gray. The issue is with the system color returned by 
> the type-property "keyboardfocusindicatorcolor" under this setting and NOT a 
> JDK product bug.
> 
> _For Mac 10.14+:_
> [controlAccentColor](https://developer.apple.com/documentation/appkit/nscolor/3000782-controlaccentcolor)
> is available and it follows accent color changes (even when application 
> started with Graphite as accent color). The proposed fix uses this type 
> property when mac version is 10.14+
> 
> PS: The native L&F (Mac OS) and Swing L&F for JTable cell tabbing differs (on 
> native tables the cell background turns white on focus with a cell focus 
> ring). Since the background for Swing tables can be set by users and also 
> overridden by subclassing `DefaultTableCellRenderer`, and to adhere to 
> current implementation of Swing, the white cell background changes are not 
> incorporated. Only the Focus Ring/ Cell Highlighter is made more prominent.

This pull request has now been integrated.

Changeset: bd6026c1
Author:    Harshitha Onkar <harshitha.on...@oracle.com>
Committer: Prasanta Sadhukhan <psadhuk...@openjdk.org>
URL:       
https://git.openjdk.java.net/jdk/commit/bd6026c10c5b24d816be9a5bf248c2aa3d8c1f4e
Stats:     263 lines in 6 files changed: 249 ins; 0 del; 14 mod

7124282: [macosx] Can't see table cell highlighter when the highlight border is 
the same color as the cell.

Reviewed-by: psadhukhan, prr

-------------

PR: https://git.openjdk.java.net/jdk/pull/7768

Reply via email to