-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
6u10
-
x86
-
windows_vista
FULL PRODUCT VERSION :
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.0.6001]
A DESCRIPTION OF THE PROBLEM :
When the JTable UI is changed from Nimbus to another UI, the selection background and foreground colors are not updated by the new UI. That is, after the UI change, the JTable still displays the foreground selection and background selection colors of the Nimbus look and feel. This is most likely due to the following code in BasicTableUI:
Color sbg = table.getSelectionBackground();
if (sbg == null || sbg instanceof UIResource) {
sbg = UIManager.getColor("Table.selectionBackground");
table.setSelectionBackground(sbg != null ? sbg : UIManager.getColor("textHighlight"));
}
Since the Nimbus LAF uses the DerivedColor class for its colors, the look and feels that extend Basic fail to recognize that the selection colors are not user-set colors, and thus will not update the selection colors.
While this may be a separate issue, I'm sure it comes from similar origins: if a JTable installs the Nimbus LAF, the grid lines vanish. When the JTable installs back to another LAF which previously had grid lines showing, the grid lines do not reappear.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a program with a non-empty JTable and the ability to install any LAF found on the system. Run program and switch from non-nimbus to nimbus, and then back to non-nimbus.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
If user has not explicitly set the JTable selection colors, the JTable should honor the selection colors of the ComponentUI.
ACTUAL -
JTable fails to honor the selection colors of the ComponentUI after installing over a Nimbus UI.
REPRODUCIBILITY :
This bug can be reproduced always.
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.0.6001]
A DESCRIPTION OF THE PROBLEM :
When the JTable UI is changed from Nimbus to another UI, the selection background and foreground colors are not updated by the new UI. That is, after the UI change, the JTable still displays the foreground selection and background selection colors of the Nimbus look and feel. This is most likely due to the following code in BasicTableUI:
Color sbg = table.getSelectionBackground();
if (sbg == null || sbg instanceof UIResource) {
sbg = UIManager.getColor("Table.selectionBackground");
table.setSelectionBackground(sbg != null ? sbg : UIManager.getColor("textHighlight"));
}
Since the Nimbus LAF uses the DerivedColor class for its colors, the look and feels that extend Basic fail to recognize that the selection colors are not user-set colors, and thus will not update the selection colors.
While this may be a separate issue, I'm sure it comes from similar origins: if a JTable installs the Nimbus LAF, the grid lines vanish. When the JTable installs back to another LAF which previously had grid lines showing, the grid lines do not reappear.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a program with a non-empty JTable and the ability to install any LAF found on the system. Run program and switch from non-nimbus to nimbus, and then back to non-nimbus.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
If user has not explicitly set the JTable selection colors, the JTable should honor the selection colors of the ComponentUI.
ACTUAL -
JTable fails to honor the selection colors of the ComponentUI after installing over a Nimbus UI.
REPRODUCIBILITY :
This bug can be reproduced always.
- duplicates
-
JDK-6788475 Changing to Nimbus LAF and back doesn't reset look and feel of JTable completely
- Resolved