6800801: NPE in JConsole when using Nimbus L&F
authoregahlin
Mon, 19 Aug 2013 16:41:21 +0200
changeset 19568 873477c7e278
parent 19567 11f4bac9b4f3
child 19569 d7ab8baed5e0
6800801: NPE in JConsole when using Nimbus L&F Reviewed-by: alanb, sjiang
jdk/src/share/classes/sun/tools/jconsole/ConnectDialog.java
jdk/src/share/classes/sun/tools/jconsole/VMPanel.java
--- a/jdk/src/share/classes/sun/tools/jconsole/ConnectDialog.java	Mon Aug 19 16:21:49 2013 +0200
+++ b/jdk/src/share/classes/sun/tools/jconsole/ConnectDialog.java	Mon Aug 19 16:41:21 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -268,8 +268,13 @@
 
     public void revalidate() {
         // Adjust some colors
+        Color disabledForeground = UIManager.getColor("Label.disabledForeground");
+        if (disabledForeground == null) {
+            // fall back for Nimbus that doesn't support 'Label.disabledForeground'
+            disabledForeground = UIManager.getColor("Label.disabledText");
+        }
         hintTextColor =
-            ensureContrast(UIManager.getColor("Label.disabledForeground"),
+            ensureContrast(disabledForeground,
                            UIManager.getColor("Panel.background"));
         disabledTableCellColor =
             ensureContrast(new Color(0x808080),
--- a/jdk/src/share/classes/sun/tools/jconsole/VMPanel.java	Mon Aug 19 16:21:49 2013 +0200
+++ b/jdk/src/share/classes/sun/tools/jconsole/VMPanel.java	Mon Aug 19 16:41:21 2013 +0200
@@ -153,9 +153,11 @@
     // in order to reserve space for the connect toggle.
     public void setUI(TabbedPaneUI ui) {
         Insets insets = (Insets) UIManager.getLookAndFeelDefaults().get("TabbedPane.tabAreaInsets");
-        insets = (Insets) insets.clone();
-        insets.right += connectedIcon24.getIconWidth() + 8;
-        UIManager.put("TabbedPane.tabAreaInsets", insets);
+        if (insets != null) {
+            insets = (Insets) insets.clone();
+            insets.right += connectedIcon24.getIconWidth() + 8;
+            UIManager.put("TabbedPane.tabAreaInsets", insets);
+        }
         super.setUI(ui);
     }