On Tue, 3 Sep 2024 08:42:03 GMT, Prasanta Sadhukhan <[email protected]>
wrote:
> I am not sure why secondary loop was added in the testcase for JDK-8078269..
That is unclear to me as well.
> JDK-8078269 issue was `TabbedPane.tabAreaBackground` should have precedence
> over `setBackground` but it was not working after JDK-8007563.. The 8007563
> tests for non-opaque case whereas 8078269 issue was for opaque. It seems if
> we put `UIManager.put("TabbedPane.tabAreaBackground", Color.GREEN); ` then
> the tabbedpane areas where there are no tabs are not GREEN but RED... Seems
> like we need a new testcase for JDK-8078269 and do away with secondary loop
> in 8007563 testcase..
This issue still exists with the existing implementation in MetalTabbedPaneUI.
If we add `UIManager.put("TabbedPane.tabAreaBackground", Color.GREEN); ` to the
existing test then the expected output is that `the tabbedpane areas where
there are no tabs should be GREEN` but it is `RED` and the reason is the
**background color instance check of UIResource** at
[L905](https://github.com/kumarabhi006/jdk/blob/73f7a5f15dbba54a98f3916ff1190520ac07874d/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java#L905).
Since `background is an instance of Color object` the condition evaluates to
**false** and the graphic's object color is set to the background of component
which is RED.
I think removal of SecondaryLoop should be ok for this PR. And for JDK-8078269
as you suggested we may need a new test case which checks for the
`UIManager.put("TabbedPane.tabAreaBackground", Color.GREEN);` as the property
is not tested here.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20791#issuecomment-2326188554