From a80621e8c223413d945ab9dc7bf1c7ef7097aed4 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 14 Dec 2009 13:25:09 +0000
Subject: [PATCH] Fix for issue 4400 (Control Panel broken in OpenJDK) The problem occurs because the default border for the list highlight provides empty insets and this generates an exception in the CompoundBorder class).  This is a bug in the OpenJDK, but the workaround is trivial (and only executed once during the loading of the classes), so I am implementing it because without it the control-panel cannot be used.

---
 opends/src/guitools/org/opends/guitools/controlpanel/ui/components/ActionButton.java |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/ActionButton.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/ActionButton.java
index 01b86e4..fb69116 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/ActionButton.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/ActionButton.java
@@ -75,6 +75,22 @@
     buttonBorder = new EmptyBorder(5, n, 5, 25);
     Border highlightBorder =
       UIManager.getBorder("List.focusCellHighlightBorder");
+    // This is required (see issue
+    // https://opends.dev.java.net/issues/show_bug.cgi?id=4400)
+    // since in OpenJDK the CompoundBorder class does not handle properly
+    // null insets.
+    if (highlightBorder != null)
+    {
+      try
+      {
+        b.setBorder(BorderFactory.createCompoundBorder(
+          highlightBorder, buttonBorder));
+      }
+      catch (Throwable t)
+      {
+        highlightBorder = null;
+      }
+    }
     if (highlightBorder == null)
     {
       highlightBorder =
@@ -103,7 +119,7 @@
   private static final Color pressedForeground =
     ColorAndFontConstants.pressedForeground;
 
-  static final Font actionFont = ColorAndFontConstants.defaultFont;
+  private static final Font actionFont = ColorAndFontConstants.defaultFont;
 
 
   /**

--
Gitblit v1.10.0