changeset 7974:f936be5be1e7

7200491: Tighten up JTable layout code Reviewed-by: art, skoivu
author rupashka
date Tue, 06 Nov 2012 15:30:34 +0400
parents 64440cc2ea8b
children 3069b91ff041
files src/share/classes/javax/swing/JTable.java src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java
diffstat 2 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/swing/JTable.java	Fri Nov 02 16:50:23 2012 -0700
+++ b/src/share/classes/javax/swing/JTable.java	Tue Nov 06 15:30:34 2012 +0400
@@ -781,15 +781,11 @@
                         scrollPane.getCorner(JScrollPane.UPPER_TRAILING_CORNER);
                 if (corner == null || corner instanceof UIResource){
                     corner = null;
-                    Object componentClass = UIManager.get(
-                            "Table.scrollPaneCornerComponent");
-                    if (componentClass instanceof Class){
-                        try {
-                            corner = (Component)
-                                    ((Class)componentClass).newInstance();
-                        } catch (Exception e) {
-                            // just ignore and don't set corner
-                        }
+                    try {
+                        corner = (Component) UIManager.get(
+                                "Table.scrollPaneCornerComponent");
+                    } catch (Exception e) {
+                        // just ignore and don't set corner
                     }
                     scrollPane.setCorner(JScrollPane.UPPER_TRAILING_CORNER,
                             corner);
--- a/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java	Fri Nov 02 16:50:23 2012 -0700
+++ b/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java	Tue Nov 06 15:30:34 2012 +0400
@@ -159,7 +159,12 @@
 
             // Store Table ScrollPane Corner Component
             uiDefaults.put("Table.scrollPaneCornerComponent",
-                    TableScrollPaneCorner.class);
+                    new UIDefaults.ActiveValue() {
+                        @Override
+                        public Object createValue(UIDefaults table) {
+                            return new TableScrollPaneCorner();
+                        }
+                    });
 
             // Setup the settings for ToolBarSeparator which is custom
             // installed for Nimbus