classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] MetalBorder.paintBorder strangeness


From: Mark Wielaard
Subject: [cp-patches] MetalBorder.paintBorder strangeness
Date: Sat, 01 Oct 2005 22:05:03 +0200

Hi,

Here is another patch made during a DevJam hacking session.
The patch made an application work. But the code looks somewhat strange
to me. Should paintBorder really explicitly check for a JTextComponent
here?

Cheers,

Mark
Index: javax/swing/plaf/metal/MetalBorders.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalBorders.java,v
retrieving revision 1.24
diff -u -r1.24 MetalBorders.java
--- javax/swing/plaf/metal/MetalBorders.java    28 Sep 2005 12:45:32 -0000      
1.24
+++ javax/swing/plaf/metal/MetalBorders.java    1 Oct 2005 20:04:30 -0000
@@ -463,8 +463,16 @@
     public void paintBorder(Component c, Graphics g, int x, int y, int w, 
         int h)
     {
-      JTextComponent tc = (JTextComponent) c;
-      if (tc.isEnabled() && tc.isEditable())
+      boolean do_super;
+      if (c instanceof  JTextComponent)
+       {
+         JTextComponent tc = (JTextComponent) c;
+         do_super = tc.isEnabled() && tc.isEditable();
+       }
+      else
+       do_super = false;
+
+      if (do_super)
         super.paintBorder(c, g, x, y, w, h);
       else
         {

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]