JDK-6469640 : SynthTableHeaderUI.HeaderRenderer unnecessary only allows SynthBorders
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: linux
  • CPU: x86
  • Submitted: 2006-09-12
  • Updated: 2017-05-23
Description
FULL PRODUCT VERSION :
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b97)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b97, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Gentoo Linux 2.6.17

A DESCRIPTION OF THE PROBLEM :
The SynthTableHeaderUI.HeaderRenderer class checks in its setBorder() method whether the border in question is an instance of SynthBorder. This might seem reasonable for a Synth component, but for normal JComponents using Synth L&F you can still set a not-Synth Border.

I came across this situation using Synth with Swinglabs components (JXTable). The JXTable creates a CompountBorder with the original SynthBorder as the outer border and a SwingLabs IconBorder as its innerborder. This IconBorder contains the table sorting order icon.

However the CompountBorder is never set because the HeaderRenderer ignores it.

Might I stipulate that the root cause of this situation is easily located in the JDK's source code (it is only a single line of code causing these problems)

As for jdk 1.6.0-b97 in SynthTableHeaderUI.java line 171 causes the problem:

170        public void setBorder(Border border) {
171            if (border instanceof SynthBorder) {
172                super.setBorder(border);
173            }
174        }

The check for instanceof SynthBorder is undesired.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a JFrame with a JXTable using a Synth based L&F. Attached is a test case with a accompaning synth style document in XML. This testcase however depends on the SwingX components of the Swinglabs project.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JXTable sorting icons are visible.
ACTUAL -
JXTable sorting icons are invisible.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Attached seperatly
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
This could be prevented if the SynthTableHeaderUI.HeaderRenderer class would no longer check wether the border is a SynthBorder instance.