[Fedora-directory-commits] console/src/com/netscape/management/client AboutDialog.java, 1.3, 1.4 ResourceCellRenderer.java, 1.1.1.1, 1.2

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Fri Dec 2 21:30:11 UTC 2005


Author: rmeggins

Update of /cvs/dirsec/console/src/com/netscape/management/client
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5215/console/src/com/netscape/management/client

Modified Files:
	AboutDialog.java ResourceCellRenderer.java 
Log Message:
Fixes to allow the console to build with gcj/classpath.  NOTE: You need a later version of Classpath than the one included with Fedora Core 4 in order to build with these changes.  But these changes work fine with Sun or IBM 1.4.2 or later javac.
Bug 170577
Bug 170823
Bug 171051
Thanks to Lillian Angel for the contribution.



Index: AboutDialog.java
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/AboutDialog.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AboutDialog.java	26 Oct 2005 23:16:15 -0000	1.3
+++ AboutDialog.java	2 Dec 2005 21:30:04 -0000	1.4
@@ -25,7 +25,6 @@
 import java.awt.*;
 
 import com.netscape.management.client.util.*;
-import com.netscape.management.nmclf.SuiConstants;
 
 /**
  * AboutDialog is a class to display a standard "about box",


Index: ResourceCellRenderer.java
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/ResourceCellRenderer.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- ResourceCellRenderer.java	18 Jul 2005 00:34:07 -0000	1.1.1.1
+++ ResourceCellRenderer.java	2 Dec 2005 21:30:04 -0000	1.2
@@ -19,15 +19,10 @@
  * END COPYRIGHT BLOCK **/
 package com.netscape.management.client;
 
-import java.util.*;
 import java.awt.*;
-import java.awt.event.*;
 import javax.swing.*;
-import javax.swing.event.*;
 import javax.swing.tree.*;
-import javax.swing.border.*;
 import javax.swing.plaf.basic.*;
-import com.netscape.management.client.util.*;
 
 /**
  * A specialized tree cell renderer for use with the ResourcePage tree.
@@ -123,13 +118,15 @@
     public void paint(Graphics g) {
         Color backgroundColor;
         Icon icon = getIcon();
-        int iconTextGap = getIconTextGap() - 2;
+        int iconTextGap = getIconTextGap();
+        String s = getText();
         int offset = 0;
-        int width = getWidth();
-        int height = getHeight();
-
-        if (iconTextGap < 0)
-            iconTextGap = 0;
+        int width = 0;
+        FontMetrics fm = getToolkit().getFontMetrics(getFont());
+        
+        if (s != null)
+            width = SwingUtilities.computeStringWidth(fm, s);
+        int height = fm.getHeight() + 2;
 
         if (icon != null)
             offset = icon.getIconWidth() + iconTextGap;
@@ -146,9 +143,9 @@
         g.setColor(backgroundColor);
 
         if (icon != null && getText() != null) {
-            g.fillRect(offset + 1, 1, width - 2 - offset, height - 2);
+            g.fillRect(offset + 1, 1, width, height);
         } else {
-            g.fillRect(1, 1, width - 2 - offset, height - 2);
+            g.fillRect(1, 1, width, height);
         }
 
         super.paint(g);
@@ -157,10 +154,10 @@
             if (_hasFocus) {
                 g.setColor(Color.black); // TODO: hard-coded value
                 BasicGraphicsUtils.drawDashedRect(g, offset, 0,
-                        width - 1 - offset, height);
+                                                  width, height);
             } else {
                 g.setColor(backgroundColor);
-                g.drawRect(offset, 0, width - 1 - offset, height - 1);
+                g.drawRect(offset, 0, width, height);
             }
         }
     }




More information about the Fedora-directory-commits mailing list