Added implementations for missing functions in MetalIconFactory and
MetalTextFieldUI.

2005-11-22  Lillian Angel  <[EMAIL PROTECTED]>

        * javax/swing/plaf/metal/MetalIconFactory.java
        (getMenuArrowIcon): Implemented.
        (getMenuItemArrowIcon): Implemented to call getMenuArrowIcon,
        because both icons look the same.
        (getMenuItemCheckIcon): Implemented.
        * javax/swing/plaf/metal/MetalTextFieldUI.java
        (propertyChange): Implemented to call super only, because it
        is a hook method. It doesn't have a different purpose from
        BasicLookAndFeel, other than allowing a subclass to override it.

Index: javax/swing/plaf/metal/MetalIconFactory.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalIconFactory.java,v
retrieving revision 1.20
diff -u -r1.20 MetalIconFactory.java
--- javax/swing/plaf/metal/MetalIconFactory.java	16 Nov 2005 15:43:34 -0000	1.20
+++ javax/swing/plaf/metal/MetalIconFactory.java	22 Nov 2005 20:11:30 -0000
@@ -2467,4 +2467,79 @@
     return treeHardDriveIcon;
   }
 
+  /**
+   * Returns a new instance of a 4 x 8 icon showing a small black triangle that
+   * points to the right.  This is displayed in menu items that have a 
+   * sub menu.
+   * 
+   * @return The icon.
+   */
+  public static Icon getMenuArrowIcon()
+  {
+    return new Icon()
+    {
+      public int getIconHeight()
+      {
+        return 8;
+      }
+
+      public int getIconWidth()
+      {
+        return 4;
+      }
+
+      public void paintIcon(Component c, Graphics g, int x, int y)
+      {
+        Color saved = g.getColor();
+        g.setColor(Color.BLACK);
+        for (int i = 0; i < 4; i++)
+          g.drawLine(x + i, y + i, x + i, y + 7 - i);
+        g.setColor(saved);
+      }
+    };
+  }
+  
+  /**
+   * Returns a new instance of a 4 x 8 icon showing a small black triangle that
+   * points to the right.  This is displayed in menu items that have a 
+   * sub menu.
+   * 
+   * @return The icon.
+   */
+  public static Icon getMenuItemArrowIcon()
+  {
+    return getMenuArrowIcon();
+  }
+  
+  /**
+   * Returns a new instance of a 13 x 13 icon showing a small black check mark.
+   * 
+   * @return The icon.
+   */
+  public static Icon getMenuItemCheckIcon()
+  {
+    return new Icon()
+    {
+      public int getIconHeight()
+      {
+        return 13;
+      }
+
+      public int getIconWidth()
+      {
+        return 13;
+      }
+
+      public void paintIcon(Component c, Graphics g, int x, int y)
+      {
+        Color saved = g.getColor();
+        g.setColor(Color.BLACK);
+        g.drawLine(3 + x, 5 + y, 3 + x, 9 + y);
+        g.drawLine(4 + x, 5 + y, 4 + x, 9 + y);
+        g.drawLine(5 + x, 7 + y, 9 + x, 3 + y);
+        g.drawLine(5 + x, 8 + y, 9 + x, 4 + y);
+        g.setColor(saved);
+      }
+    };
+  }
 }
Index: javax/swing/plaf/metal/MetalTextFieldUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalTextFieldUI.java,v
retrieving revision 1.6
diff -u -r1.6 MetalTextFieldUI.java
--- javax/swing/plaf/metal/MetalTextFieldUI.java	27 Oct 2005 09:50:58 -0000	1.6
+++ javax/swing/plaf/metal/MetalTextFieldUI.java	22 Nov 2005 20:11:30 -0000
@@ -38,6 +38,8 @@
 
 package javax.swing.plaf.metal;
 
+import java.beans.PropertyChangeEvent;
+
 import javax.swing.JComponent;
 import javax.swing.JTextField;
 import javax.swing.plaf.ComponentUI;
@@ -66,5 +68,15 @@
   public static ComponentUI createUI(JComponent component)
   {
     return new MetalTextFieldUI();
+  }
+  
+  /**
+   * This method gets called when a bound property is changed on the associated
+   * JTextComponent. This is a hook which UI implementations may change to 
+   * reflect how the UI displays bound properties of JTextComponent subclasses.
+   */
+  public void propertyChange(PropertyChangeEvent evt)
+  {
+    super.propertyChange(evt);
   }
 }
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to