United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6511744 JRadioButton in JTree is not painted in correct state on Vista
JDK-6511744 : JRadioButton in JTree is not painted in correct state on Vista

Details
Type:
Bug
Submit Date:
2007-01-10
Status:
Closed
Updated Date:
2011-03-07
Project Name:
JDK
Resolved Date:
2011-03-07
Component:
client-libs
OS:
windows_vista
Sub-Component:
javax.swing
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Relates:

Sub Tasks

Description
from ###@###.###:
I am trying to figure out the cause of some strange behavior of JRadioButtons embedded in JTree on Vista.  This is happening in Advanced tab of Java Control Panel.  There is a JTree containing nodes of JRadioButton(s).  Multiple radio buttons are painted selected on windows Vista.  You can see this on example of Java console node.  The buttons get selected pretty much randomly.  The radio button I click on usually is the one NOT selected, while the other two or more (or none at all) would get selected.

I noticed that this behavior is happening with Vista colors and appearance.  If I change the windows appearance to Classic this is not happening.  With JRE 1.5.0_09 this is not happening either even with Vista Aero appearance.
I suspect that this behavior has something to do with vista L&F implementation.  Could you please take a look at this?  This is rather urgent since it makes the Java Control Panel totally useless on Vista.

                                    

Comments
EVALUATION

This is a regression introduced by the fix for 
6435825 [Win Vista: add animation support for swing components.]
That fix sends a number of repaint events to a component to animate it from the old state to the new one. It works under the assumption that there is a one to one mapping between an instance of component and rendered widget on the screen. This assumption is wrong for JTree, JList and JTable for they might have the same component used to render multiple widgets on the screen.
                                     
2007-01-10
WORK AROUND

One can disable animation on vista running java with
java -Dswing.disablevistaanimation=true

that should fix this problem
                                     
2007-01-10
EVALUATION

Unfortunately I do not see how we can support animation for JTable, JTree and JList.
I suggest to disable it for these components.

----
--- XPStyle.java	Wed Jan 10 17:13:32 2007
***************
*** 571,581 ****
           *                  the image to be stretched or tiled
           * @param state which state to paint
           */
          void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state) {
              if (ThemeReader.isGetThemeTransitionDurationDefined() 
!                   && component instanceof JComponent ) {
                  AnimationController.paintSkin((JComponent) component, this, 
                                                g, dx, dy, dw, dh, state);
              } else {
                  paintSkinRaw(g, dx, dy, dw, dh, state);
              }
--- 571,583 ----
           *                  the image to be stretched or tiled
           * @param state which state to paint
           */
          void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state) {
              if (ThemeReader.isGetThemeTransitionDurationDefined() 
!                   && component instanceof JComponent 
!                   && SwingUtilities.getAncestorOfClass(CellRendererPane.class, 
!                                                        component) == null) {
                  AnimationController.paintSkin((JComponent) component, this, 
                                                g, dx, dy, dw, dh, state);
              } else {
                  paintSkinRaw(g, dx, dy, dw, dh, state);
              }

----

Do not do animation for any component which belongs to CellRendererPane. That solves it for JTree, JTable and JList
                                     
2007-01-10



Hardware and Software, Engineered to Work Together