GtkListPeer.java, [...]: Fix handling of alias methods...
authorThomas Fitzsimmons <fitzsim@redhat.com>
Tue, 3 Feb 2004 17:10:56 +0000 (17:10 +0000)
committerThomas Fitzsimmons <fitzsim@gcc.gnu.org>
Tue, 3 Feb 2004 17:10:56 +0000 (17:10 +0000)
2004-02-03  Thomas Fitzsimmons  <fitzsim@redhat.com>

* gnu/java/awt/peer/gtk/GtkListPeer.java,
java/awt/BorderLayout.java, java/awt/CardLayout.java,
java/awt/CheckboxGroup.java, java/awt/Choice.java,
java/awt/Component.java, java/awt/Container.java,
java/awt/FontMetrics.java, java/awt/GridBagLayout.java,
java/awt/LayoutManager2.java, java/awt/List.java,
java/awt/Menu.java, java/awt/MenuBar.java,
java/awt/MenuItem.java, java/awt/Polygon.java,
java/awt/Rectangle.java, java/awt/ScrollPane.java,
java/awt/Scrollbar.java, java/awt/TextArea.java,
java/awt/TextField.java,
java/awt/image/renderable/RenderContext.java,
javax/swing/JApplet.java: Fix handling of alias methods, where a
method has been deprecated in favour of a new one with the same
funtion but a different name.  Put the method implementation in
the deprecated method and have the new method call the
deprecated one.  Make all other code call the new method.

From-SVN: r77178

23 files changed:
libjava/ChangeLog
libjava/gnu/java/awt/peer/gtk/GtkListPeer.java
libjava/java/awt/BorderLayout.java
libjava/java/awt/CardLayout.java
libjava/java/awt/CheckboxGroup.java
libjava/java/awt/Choice.java
libjava/java/awt/Component.java
libjava/java/awt/Container.java
libjava/java/awt/FontMetrics.java
libjava/java/awt/GridBagLayout.java
libjava/java/awt/LayoutManager2.java
libjava/java/awt/List.java
libjava/java/awt/Menu.java
libjava/java/awt/MenuBar.java
libjava/java/awt/MenuItem.java
libjava/java/awt/Polygon.java
libjava/java/awt/Rectangle.java
libjava/java/awt/ScrollPane.java
libjava/java/awt/Scrollbar.java
libjava/java/awt/TextArea.java
libjava/java/awt/TextField.java
libjava/java/awt/image/renderable/RenderContext.java
libjava/javax/swing/JApplet.java

index 3392b3b491381d2fed172c7d10534e3e7bb9af0c..69ea3321ec6ec6ef66727b1940cb9101222cc3a6 100644 (file)
@@ -1,3 +1,23 @@
+2004-02-03  Thomas Fitzsimmons  <fitzsim@redhat.com>
+
+       * gnu/java/awt/peer/gtk/GtkListPeer.java,
+       java/awt/BorderLayout.java, java/awt/CardLayout.java,
+       java/awt/CheckboxGroup.java, java/awt/Choice.java,
+       java/awt/Component.java, java/awt/Container.java,
+       java/awt/FontMetrics.java, java/awt/GridBagLayout.java,
+       java/awt/LayoutManager2.java, java/awt/List.java,
+       java/awt/Menu.java, java/awt/MenuBar.java,
+       java/awt/MenuItem.java, java/awt/Polygon.java,
+       java/awt/Rectangle.java, java/awt/ScrollPane.java,
+       java/awt/Scrollbar.java, java/awt/TextArea.java,
+       java/awt/TextField.java,
+       java/awt/image/renderable/RenderContext.java,
+       javax/swing/JApplet.java: Fix handling of alias methods, where a
+       method has been deprecated in favour of a new one with the same
+       funtion but a different name.  Put the method implementation in
+       the deprecated method and have the new method call the
+       deprecated one.  Make all other code call the new method.
+
 2004-02-03  Mohan Embar  <gnustuff@thisiscool.com>
 
        * gnu/java/nio/DatagramChannelImpl.java
index ac2c361495a0e9137d0394ef1e1d590d6165f0b8..7517c64655f76a48644c799108d46d2c1a2df47b 100644 (file)
@@ -85,18 +85,12 @@ public class GtkListPeer extends GtkComponentPeer
   
   public Dimension getMinimumSize (int rows)
   {
-    int dims[] = new int[2];
-
-    getSize (rows, dims);
-    return (new Dimension (dims[0], dims[1]));
+    return minimumSize (rows);
   }
 
   public Dimension getPreferredSize (int rows)
   {
-    int dims[] = new int[2];
-
-    getSize (rows, dims);
-    return (new Dimension (dims[0], dims[1]));
+    return preferredSize (rows);
   }
   
   public native int[] getSelectedIndexes ();
@@ -104,12 +98,18 @@ public class GtkListPeer extends GtkComponentPeer
 
   public Dimension minimumSize (int rows)
   {
-    return (getMinimumSize (rows));
+    int dims[] = new int[2];
+
+    getSize (rows, dims);
+    return new Dimension (dims[0], dims[1]);
   }
 
   public Dimension preferredSize (int rows)
   {
-    return (getPreferredSize (rows));
+    int dims[] = new int[2];
+
+    getSize (rows, dims);
+    return new Dimension (dims[0], dims[1]);
   }
 
   public void removeAll ()
index 930773f0142a497bf476178ece6cec7e9a20645f..5033bcf7ab29a1fe37043c37910bda2f9188c365 100644 (file)
@@ -349,7 +349,28 @@ addLayoutComponent(Component component, Object constraints)
   if (constraints != null && ! (constraints instanceof String))
     throw new IllegalArgumentException("Constraint must be a string");
 
-  String str = (String)constraints;
+  addLayoutComponent((String) constraints, component);
+}
+
+/*************************************************************************/
+
+/**
+  * Adds a component to the layout in the specified constraint position, 
+  * which must be one of the string constants defined in this class.
+  *
+  * @param constraints The constraint string.
+  * @param component The component to add.
+  *
+  * @exception IllegalArgumentException If the constraint object is not
+  * one of the specified constants in this class.
+  *
+  * @deprecated This method is deprecated in favor of
+  * <code>addLayoutComponent(Component, Object)</code>.
+  */
+public void
+addLayoutComponent(String constraints, Component component)
+{
+  String str = constraints;
 
   if (str == null || str.equals(CENTER))
     center = component;
@@ -375,27 +396,6 @@ addLayoutComponent(Component component, Object constraints)
 
 /*************************************************************************/
 
-/**
-  * Adds a component to the layout in the specified constraint position, 
-  * which must be one of the string constants defined in this class.
-  *
-  * @param constraints The constraint string.
-  * @param component The component to add.
-  *
-  * @exception IllegalArgumentException If the constraint object is not
-  * one of the specified constants in this class.
-  *
-  * @deprecated This method is deprecated in favor of
-  * <code>addLayoutComponent(Component, Object)</code>.
-  */
-public void
-addLayoutComponent(String constraints, Component component)
-{
-  addLayoutComponent(component, constraints);
-}
-
-/*************************************************************************/
-
 /**
   * Removes the specified component from the layout.
   *
index 1900a6094e2cfa6da14fd4ea71435290a3b0516f..c3c9f5381d55b282bece1e2ed757745143d41b4b 100644 (file)
@@ -90,7 +90,7 @@ public class CardLayout implements LayoutManager2, Serializable
     if (! (constraints instanceof String))
       throw new IllegalArgumentException ("Object " + constraints
                                          + " is not a string");
-    tab.put (constraints, comp);
+    addLayoutComponent ((String) constraints, comp);
   }
 
   /** Add a new component to the layout.  The name can be used later
@@ -102,7 +102,7 @@ public class CardLayout implements LayoutManager2, Serializable
    */
   public void addLayoutComponent (String name, Component comp)
   {
-    addLayoutComponent (comp, name);
+    tab.put (name, comp);
   }
 
   /** Cause the first component in the container to be displayed.
index 64d01951dbf455df21945c9d1f129a28b2ca2e4e..52af1903a9c3455a271f00b5fab4936050a3d0c3 100644 (file)
@@ -95,8 +95,8 @@ CheckboxGroup()
 public Checkbox
 getSelectedCheckbox()
 {
-  return(selectedCheckbox);
-} 
+  return getCurrent ();
+}
 
 /*************************************************************************/
 
@@ -126,17 +126,7 @@ getCurrent()
 public void
 setSelectedCheckbox(Checkbox selectedCheckbox)
 {
-  if (this.selectedCheckbox != null)
-    {
-      if (this.selectedCheckbox.getCheckboxGroup() != this)
-        return;
-
-      this.selectedCheckbox.setState(false);
-    }
-
-  this.selectedCheckbox = selectedCheckbox;
-  if (selectedCheckbox != null)
-    selectedCheckbox.setState(true);
+  setCurrent (selectedCheckbox);
 }
 
 /*************************************************************************/
@@ -153,7 +143,17 @@ setSelectedCheckbox(Checkbox selectedCheckbox)
 public void
 setCurrent(Checkbox selectedCheckbox)
 {
-  setSelectedCheckbox(selectedCheckbox);
+  if (this.selectedCheckbox != null)
+    {
+      if (this.selectedCheckbox.getCheckboxGroup() != this)
+        return;
+
+      this.selectedCheckbox.setState(false);
+    }
+
+  this.selectedCheckbox = selectedCheckbox;
+  if (selectedCheckbox != null)
+    selectedCheckbox.setState(true);
 }
 
 /*************************************************************************/
index d1f601f777d055e979815fb659f0d3ddc33312ca..b2b597ed06fce7d66f550a46a9934c9c05525abe 100644 (file)
@@ -111,7 +111,7 @@ private ItemListener item_listeners;
 public int
 getItemCount()
 {
-  return(pItems.size());
+  return countItems ();
 }
 
 /*************************************************************************/
index 87c73b51e151eb659fc30ab8ee4208f84a181cb6..f2fcef59b1942ba8e8e03af2820c68ca36494008 100644 (file)
@@ -779,9 +779,7 @@ public abstract class Component
    */
   public void setEnabled(boolean b)
   {
-    this.enabled = b;
-    if (peer != null)
-      peer.setEnabled(b);
+    enable (b);
   }
 
   /**
@@ -791,7 +789,9 @@ public abstract class Component
    */
   public void enable()
   {
-    setEnabled(true);
+    this.enabled = true;
+    if (peer != null)
+      peer.setEnabled (true);
   }
 
   /**
@@ -802,7 +802,10 @@ public abstract class Component
    */
   public void enable(boolean b)
   {
-    setEnabled(b);
+    if (b)
+      enable ();
+    else
+      disable ();
   }
 
   /**
@@ -812,7 +815,9 @@ public abstract class Component
    */
   public void disable()
   {
-    setEnabled(false);
+    this.enabled = false;
+    if (peer != null)
+      peer.setEnabled (false);
   }
 
   /**
@@ -856,10 +861,7 @@ public abstract class Component
     // Inspection by subclassing shows that Sun's implementation calls
     // show(boolean) which then calls show() or hide(). It is the show()
     // method that is overriden in subclasses like Window.
-    if (b)
-      show();
-    else
-      hide();
+    show (b);
   }
 
   /**
@@ -887,7 +889,10 @@ public abstract class Component
    */
   public void show(boolean b)
   {
-    setVisible(b);
+    if (b)
+      show ();
+    else
+      hide ();
   }
 
   /**
@@ -1083,7 +1088,7 @@ public abstract class Component
    */
   public Point getLocation()
   {
-    return new Point(x, y);
+    return location ();
   }
 
   /**
@@ -1110,7 +1115,7 @@ public abstract class Component
    */
   public Point location()
   {
-    return getLocation();
+    return new Point (x, y);
   }
 
   /**
@@ -1125,13 +1130,7 @@ public abstract class Component
    */
   public void setLocation(int x, int y)
   {
-    if (this.x == x && this.y == y)
-      return;
-    invalidate();
-    this.x = x;
-    this.y = y;
-    if (peer != null)
-      peer.setBounds(x, y, width, height);
+    move (x, y);
   }
 
   /**
@@ -1145,7 +1144,13 @@ public abstract class Component
    */
   public void move(int x, int y)
   {
-    setLocation(x, y);
+    if (this.x == x && this.y == y)
+      return;
+    invalidate ();
+    this.x = x;
+    this.y = y;
+    if (peer != null)
+      peer.setBounds (x, y, width, height);
   }
 
   /**
@@ -1173,7 +1178,7 @@ public abstract class Component
    */
   public Dimension getSize()
   {
-    return new Dimension(width, height);
+    return size ();
   }
 
   /**
@@ -1184,7 +1189,7 @@ public abstract class Component
    */
   public Dimension size()
   {
-    return getSize();
+    return new Dimension (width, height);
   }
 
   /**
@@ -1197,13 +1202,7 @@ public abstract class Component
    */
   public void setSize(int width, int height)
   {
-    if (this.width == width && this.height == height)
-      return;
-    invalidate();
-    this.width = width;
-    this.height = height;
-    if (peer != null)
-      peer.setBounds(x, y, width, height);
+    resize (width, height);
   }
 
   /**
@@ -1215,7 +1214,13 @@ public abstract class Component
    */
   public void resize(int width, int height)
   {
-    setSize(width, height);
+    if (this.width == width && this.height == height)
+      return;
+    invalidate ();
+    this.width = width;
+    this.height = height;
+    if (peer != null)
+      peer.setBounds (x, y, width, height);
   }
 
   /**
@@ -1229,7 +1234,7 @@ public abstract class Component
    */
   public void setSize(Dimension d)
   {
-    setSize(d.width, d.height);
+    resize (d);
   }
 
   /**
@@ -1241,7 +1246,7 @@ public abstract class Component
    */
   public void resize(Dimension d)
   {
-    setSize(d.width, d.height);
+    resize (d.width, d.height);
   }
 
   /**
@@ -1256,7 +1261,7 @@ public abstract class Component
    */
   public Rectangle getBounds()
   {
-    return new Rectangle(x, y, width, height);
+    return bounds ();
   }
 
   /**
@@ -1269,7 +1274,7 @@ public abstract class Component
    */
   public Rectangle bounds()
   {
-    return getBounds();
+    return new Rectangle (x, y, width, height);
   }
 
   /**
@@ -1289,15 +1294,7 @@ public abstract class Component
    */
   public void setBounds(int x, int y, int w, int h)
   {
-    if (this.x == x && this.y == y && width == w && height == h)
-      return;
-    invalidate();
-    this.x = x;
-    this.y = y;
-    width = w;
-    height = h;
-    if (peer != null)
-      peer.setBounds(x, y, w, h);
+    reshape (x, y, w, h);
   }
 
   /**
@@ -1306,13 +1303,22 @@ public abstract class Component
    *
    * @param x the X coordinate of the upper left corner of the rectangle
    * @param y the Y coordinate of the upper left corner of the rectangle
-   * @param w the width of the rectangle
-   * @param h the height of the rectangle
+   * @param width the width of the rectangle
+   * @param height the height of the rectangle
    * @deprecated use {@link #setBounds(int, int, int, int)} instead
    */
   public void reshape(int x, int y, int width, int height)
   {
-    setBounds(x, y, width, height);
+    if (this.x == x && this.y == y
+        && this.width == width && this.height == height)
+      return;
+    invalidate ();
+    this.x = x;
+    this.y = y;
+    this.width = width;
+    this.height = height;
+    if (peer != null)
+      peer.setBounds (x, y, width, height);
   }
 
   /**
@@ -1329,7 +1335,7 @@ public abstract class Component
    */
   public void setBounds(Rectangle r)
   {
-    setBounds(r.x, r.y, r.width, r.height);
+    setBounds (r.x, r.y, r.width, r.height);
   }
 
   /**
@@ -1560,7 +1566,7 @@ public abstract class Component
    */
   public void doLayout()
   {
-    // nothing to do unless we're a container
+    layout ();
   }
 
   /**
@@ -1571,7 +1577,7 @@ public abstract class Component
    */
   public void layout()
   {
-    doLayout();
+    // Nothing to do unless we're a container.
   }
 
   /**
@@ -2076,7 +2082,7 @@ public abstract class Component
    */
   public boolean contains(int x, int y)
   {
-    return x >= 0 && y >= 0 && x < width && y < height;
+    return inside (x, y);
   }
 
   /**
@@ -2090,7 +2096,7 @@ public abstract class Component
    */
   public boolean inside(int x, int y)
   {
-    return contains(x, y);
+    return x >= 0 && y >= 0 && x < width && y < height;
   }
 
   /**
@@ -2105,7 +2111,7 @@ public abstract class Component
    */
   public boolean contains(Point p)
   {
-    return contains(p.x, p.y);
+    return contains (p.x, p.y);
   }
 
   /**
@@ -2120,7 +2126,7 @@ public abstract class Component
    */
   public Component getComponentAt(int x, int y)
   {
-    return contains(x, y) ? this : null;
+    return locate (x, y);
   }
 
   /**
@@ -2135,7 +2141,7 @@ public abstract class Component
    */
   public Component locate(int x, int y)
   {
-    return getComponentAt(x, y);
+    return contains (x, y) ? this : null;
   }
 
   /**
@@ -2151,7 +2157,7 @@ public abstract class Component
    */
   public Component getComponentAt(Point p)
   {
-    return getComponentAt(p.x, p.y);
+    return getComponentAt (p.x, p.y);
   }
 
   /**
index 57cd8338ce98b92945783829d216f8f1a501d0a0..ed869e18eae91c5af00b62ce66b4f08bb319321e 100644 (file)
@@ -106,7 +106,7 @@ public class Container extends Component
    */
   public int getComponentCount()
   {
-    return ncomponents;
+    return countComponents ();
   }
 
   /**
@@ -118,7 +118,7 @@ public class Container extends Component
    */
   public int countComponents()
   {
-    return getComponentCount();
+    return ncomponents;
   }
 
   /**
@@ -186,10 +186,7 @@ public class Container extends Component
    */
   public Insets getInsets()
   {
-    if (peer == null)
-      return new Insets(0, 0, 0, 0);
-    
-    return ((ContainerPeer) peer).getInsets();
+    return insets ();
   }
 
   /**
@@ -201,7 +198,10 @@ public class Container extends Component
    */
   public Insets insets()
   {
-    return getInsets();
+    if (peer == null)
+      return new Insets (0, 0, 0, 0);
+
+    return ((ContainerPeer) peer).getInsets ();
   }
 
   /**
@@ -463,8 +463,7 @@ public class Container extends Component
    */
   public void doLayout()
   {
-    if (layoutMgr != null)
-      layoutMgr.layoutContainer(this);
+    layout ();
   }
 
   /**
@@ -474,7 +473,8 @@ public class Container extends Component
    */
   public void layout()
   {
-    doLayout();
+    if (layoutMgr != null)
+      layoutMgr.layoutContainer (this);
   }
 
   /**
@@ -555,7 +555,7 @@ public class Container extends Component
    */
   public Dimension getPreferredSize()
   {
-      return preferredSize();
+    return preferredSize ();
   }
 
   /**
@@ -567,10 +567,10 @@ public class Container extends Component
    */
   public Dimension preferredSize()
   {
-      if (layoutMgr != null)
-         return layoutMgr.preferredLayoutSize(this);
-      else
-         return super.preferredSize();
+    if (layoutMgr != null)
+      return layoutMgr.preferredLayoutSize (this);
+    else
+      return super.preferredSize ();
   }
 
   /**
@@ -580,7 +580,7 @@ public class Container extends Component
    */
   public Dimension getMinimumSize()
   {
-      return minimumSize();
+    return minimumSize ();
   }
 
   /**
@@ -592,10 +592,10 @@ public class Container extends Component
    */
   public Dimension minimumSize()
   {
-      if (layoutMgr != null)
-         return layoutMgr.minimumLayoutSize(this);
-      else
-         return super.minimumSize();
+    if (layoutMgr != null)
+      return layoutMgr.minimumLayoutSize (this);
+    else
+      return super.minimumSize ();
   }
 
   /**
@@ -833,23 +833,7 @@ public class Container extends Component
    */
   public Component getComponentAt(int x, int y)
   {
-    synchronized (getTreeLock ())
-      {
-        if (! contains(x, y))
-          return null;
-        for (int i = 0; i < ncomponents; ++i)
-          {
-            // Ignore invisible children...
-            if (!component[i].isVisible())
-              continue;
-
-            int x2 = x - component[i].x;
-            int y2 = y - component[i].y;
-            if (component[i].contains(x2, y2))
-              return component[i];
-          }
-        return this;
-      }
+    return locate (x, y);
   }
 
   /**
@@ -869,7 +853,23 @@ public class Container extends Component
    */
   public Component locate(int x, int y)
   {
-    return getComponentAt(x, y);
+    synchronized (getTreeLock ())
+      {
+        if (!contains (x, y))
+          return null;
+        for (int i = 0; i < ncomponents; ++i)
+          {
+            // Ignore invisible children...
+            if (!component[i].isVisible ())
+              continue;
+
+            int x2 = x - component[i].x;
+            int y2 = y - component[i].y;
+            if (component[i].contains (x2, y2))
+              return component[i];
+          }
+        return this;
+      }
   }
 
   /**
@@ -886,7 +886,7 @@ public class Container extends Component
    */
   public Component getComponentAt(Point p)
   {
-    return getComponentAt(p.x, p.y);
+    return getComponentAt (p.x, p.y);
   }
 
   public Component findComponentAt(int x, int y)
index ce340dadbe6e8da86858869e4a974182b403334f..a7f76e03ae75aaca84ea50251f2a8fbb6f437e6a 100644 (file)
@@ -195,7 +195,7 @@ getMaxAscent()
 public int
 getMaxDescent()
 {
-  return(getDescent());
+  return getMaxDecent ();
 }
 
 /*************************************************************************/
@@ -212,7 +212,7 @@ getMaxDescent()
 public int
 getMaxDecent()
 {
-  return(getMaxDescent());
+  return getDescent ();
 }
 
 /*************************************************************************/
index 7572c1d1d565e114bb9003fcf2c16b5e55f9df70..2cf8daa6b181540a85a2c732011a691ae1bc5070 100644 (file)
@@ -149,7 +149,7 @@ public class GridBagLayout
 
     public void layoutContainer (Container parent)
     {
-       arrangeGrid (parent);
+      arrangeGrid (parent);
     }
 
     public float getLayoutAlignmentX (Container target)
@@ -302,7 +302,8 @@ public class GridBagLayout
      */
     protected void AdjustForGravity (GridBagConstraints gbc, Rectangle rect)
     {
-       adjustForGravity (gbc, rect);
+      // FIXME
+      throw new Error ("Not implemented");
     }
 
     /**
@@ -310,7 +311,115 @@ public class GridBagLayout
      */
     protected void ArrangeGrid (Container parent)
     {
-       arrangeGrid (parent);
+      Component[] components = parent.getComponents();
+
+      if (components.length == 0)
+        return;
+
+      GridBagLayoutInfo info = getLayoutInfo (parent, PREFERREDSIZE);
+      if (info.cols == 0 && info.rows == 0)
+        return;
+      layoutInfo = info;
+
+      // DEBUG
+      //dumpLayoutInfo (layoutInfo);
+    
+      for(int i = 0; i < components.length; i++)
+       {
+          Component component = components [i];
+               
+          // If component is not visible we dont have to care about it.
+          if (!component.isVisible())
+            continue;
+               
+          GridBagConstraints constraints = lookupConstraints (component);
+
+          int cellx = sumIntArray(layoutInfo.colWidths, constraints.gridx);
+          int celly = sumIntArray(layoutInfo.rowHeights, constraints.gridy);
+          int cellw = sumIntArray(layoutInfo.colWidths,
+                                  constraints.gridx + constraints.gridwidth) - cellx;
+          int cellh = sumIntArray(layoutInfo.rowHeights,
+                                  constraints.gridy + constraints.gridheight) - celly;
+
+          Insets insets = constraints.insets;
+          if (insets != null)
+           {
+              cellx += insets.left;
+              celly += insets.top;
+              cellw -= insets.left + insets.right;
+              cellh -= insets.top + insets.bottom;
+           }
+
+          Dimension dim = component.getPreferredSize();
+
+          // Note: Documentation says that padding is added on both sides, but
+          // visual inspection shows that the Sun implementation only adds it
+          // once, so we do the same.
+          dim.width += constraints.ipadx;
+          dim.height += constraints.ipady;
+
+          switch(constraints.fill)
+           {
+            case GridBagConstraints.HORIZONTAL:
+              dim.width = cellw;
+              break;
+            case GridBagConstraints.VERTICAL:
+              dim.height = cellh;
+              break;
+            case GridBagConstraints.BOTH:
+              dim.width = cellw;
+              dim.height = cellh;
+              break;
+           }
+
+          int x;
+          int y;
+
+          switch(constraints.anchor)
+           {
+            case GridBagConstraints.NORTH:
+              x = cellx + (cellw - dim.width) / 2;
+              y = celly;
+              break;
+            case GridBagConstraints.SOUTH:
+              x = cellx + (cellw - dim.width) / 2;
+              y = celly + cellh - dim.height;
+              break;
+            case GridBagConstraints.WEST:
+              x = cellx;
+              y = celly + (cellh - dim.height) / 2;
+              break;
+            case GridBagConstraints.EAST:
+              x = cellx + cellw - dim.width;
+              y = celly + (cellh - dim.height) / 2;
+              break;
+            case GridBagConstraints.NORTHEAST:
+              x = cellx + cellw - dim.width;
+              y = celly;
+              break;
+            case GridBagConstraints.NORTHWEST:
+              x = cellx;
+              y = celly;
+              break;
+            case GridBagConstraints.SOUTHEAST:
+              x = cellx + cellw - dim.width;
+              y = celly + cellh - dim.height;
+              break;
+            case GridBagConstraints.SOUTHWEST:
+              x = cellx;
+              y = celly + cellh - dim.height;
+              break;
+            default:
+              x = cellx + (cellw - dim.width) / 2;
+              y = celly + (cellh - dim.height) / 2;
+              break;
+           }
+
+          component.setBounds(layoutInfo.pos_x + x, layoutInfo.pos_y + y, dim.width, dim.height);
+       }
+
+      // DEBUG
+      //dumpLayoutInfo (layoutInfo);
     }
 
     /**
@@ -318,7 +427,160 @@ public class GridBagLayout
      */
     protected GridBagLayoutInfo GetLayoutInfo (Container parent, int sizeflag)
     {
-       return getLayoutInfo (parent, sizeflag);
+      if (sizeflag != MINSIZE && sizeflag != PREFERREDSIZE)
+        throw new IllegalArgumentException();
+
+      Dimension parentDim = parent.getSize ();
+      Insets parentInsets = parent.getInsets ();
+      parentDim.width -= parentInsets.left + parentInsets.right;
+      parentDim.height -= parentInsets.top + parentInsets.bottom;
+   
+      int x = 0;
+      int y = 0;
+      int max_x = 0;
+      int max_y = 0;
+
+      // first we figure out how many rows/columns
+      Component[] components = parent.getComponents();
+      for (int i = 0; i < components.length; i++)
+       {
+          Component component = components [i];
+               
+          // If component is not visible we dont have to care about it.
+          if (!component.isVisible())
+            continue;
+               
+          GridBagConstraints constraints = lookupConstraints (component);
+               
+          if(constraints.gridx == GridBagConstraints.RELATIVE)
+            constraints.gridx = x;
+
+          if(constraints.gridy == GridBagConstraints.RELATIVE)
+            constraints.gridy = y;
+               
+          max_x = Math.max(max_x, 
+                           constraints.gridx + Math.max(1, constraints.gridwidth));
+          max_y = Math.max(max_y,
+                           constraints.gridy + Math.max(1, constraints.gridheight));
+
+          if(constraints.gridwidth == GridBagConstraints.REMAINDER)
+           {
+              x = 0;
+              y++;
+           }
+          else
+           {
+              x = constraints.gridx + Math.max(1, constraints.gridwidth);
+              y = constraints.gridy;
+           }
+       }
+       
+      GridBagLayoutInfo info = new GridBagLayoutInfo(max_x, max_y);
+
+      for (x = 0; x <= max_x; x++)
+       {
+          if(columnWidths != null && columnWidths.length > x)
+           {
+              info.colWidths[x] = columnWidths[x];
+           }
+          if(columnWeights != null && columnWeights.length > x)
+           {
+              info.colWeights[x] = columnWeights[x];
+           }
+          for (int i = 0; i < components.length; i++)
+           {
+              Component component = components [i];
+                       
+              // If component is not visible we dont have to care about it.
+              if (!component.isVisible())
+                continue;
+                       
+              GridBagConstraints constraints = lookupConstraints (component);
+
+              // first we fix up any REMAINDER cells
+              if(constraints.gridwidth == GridBagConstraints.REMAINDER)
+               {
+                  constraints.gridwidth = max_x - constraints.gridx;
+               }
+              if(constraints.gridheight == GridBagConstraints.REMAINDER)
+               {
+                  constraints.gridheight = max_y - constraints.gridy;
+               }
+
+              if(constraints.gridx + constraints.gridwidth - 1 == x)
+               {
+                  int width = (sizeflag == PREFERREDSIZE) ?
+                    component.getPreferredSize().width :
+                    component.getMinimumSize().width;
+                  if(constraints.insets != null)
+                   {
+                      width += constraints.insets.left + constraints.insets.right;
+                   }
+                  width += constraints.ipadx;
+                  for(int w = 1; w < constraints.gridwidth; w++)
+                   {
+                      width -= info.colWidths[x - w];
+                   }
+                  info.colWidths[x] = Math.max(info.colWidths[x], width);
+                  info.colWeights[x] =
+                    Math.max(info.colWeights[x], constraints.weightx);
+               }
+           }
+       }
+
+      for (y = 0; y <= max_y; y++)
+       {
+          if(rowHeights != null && rowHeights.length > y)
+           {
+              info.rowHeights[y] = rowHeights[y];
+           }
+          if(rowWeights != null && rowWeights.length > y)
+           {
+              info.rowWeights[y] = rowWeights[y];
+           }
+          for (int i = 0; i < components.length; i++)
+           {
+              Component component = components [i];
+                       
+              // If component is not visible we dont have to care about it.
+              if (!component.isVisible())
+                continue;
+                       
+              GridBagConstraints constraints = lookupConstraints (component);
+
+              if(constraints.gridy + constraints.gridheight - 1 == y)
+               {
+                  int height = (sizeflag == PREFERREDSIZE) ?
+                    component.getPreferredSize().height :
+                    component.getMinimumSize().height;
+                  if(constraints.insets != null)
+                   {
+                      height += constraints.insets.top + constraints.insets.bottom;
+                   } 
+                  height += constraints.ipady;
+                  for(int h = 1; h < constraints.gridheight; h++)
+                   {
+                      height -= info.rowHeights[y - h];
+                   }
+                  info.rowHeights[y] = Math.max(info.rowHeights[y], height);
+                  info.rowWeights[y] =
+                    Math.max(info.rowWeights[y], constraints.weighty);
+               }
+           }
+       }
+
+      calcCellSizes (info.colWidths, info.colWeights, parentDim.width);
+      calcCellSizes (info.rowHeights, info.rowWeights, parentDim.height);
+
+      int totalWidth = sumIntArray(info.colWidths);
+      int totalHeight = sumIntArray(info.rowHeights);
+      info.pos_x = parentInsets.left + (parentDim.width - totalWidth) / 2;
+      info.pos_y = parentInsets.top + (parentDim.height - totalHeight) / 2;
+
+      // DEBUG
+      //dumpLayoutInfo (info);
+
+      return info;
     }
 
     /**
@@ -326,7 +588,13 @@ public class GridBagLayout
      */
     protected Dimension GetMinSize (Container parent, GridBagLayoutInfo info)
     {
-       return getMinSize (parent, info);
+      if (parent == null || info == null)
+        return new Dimension (0, 0);
+
+      Insets insets = parent.getInsets();
+      int width = sumIntArray (info.colWidths) + insets.left + insets.right;
+      int height = sumIntArray (info.rowHeights) + insets.top + insets.bottom;
+      return new Dimension (width, height);
     }
 
     /**
@@ -334,13 +602,7 @@ public class GridBagLayout
      */
     protected Dimension getMinSize (Container parent, GridBagLayoutInfo info)
     {
-       if (parent == null || info == null)
-           return new Dimension (0, 0);
-
-       Insets insets = parent.getInsets();
-       int width = sumIntArray (info.colWidths) + insets.left + insets.right;
-       int height = sumIntArray (info.rowHeights) + insets.top + insets.bottom;
-       return new Dimension (width, height);
+      return GetMinSize (parent, info);
     }
 
     private void calcCellSizes (int[] sizes, double[] weights, int range)
@@ -404,116 +666,7 @@ public class GridBagLayout
      */
     protected void arrangeGrid (Container parent)
     {
-       Component[] components = parent.getComponents();
-
-       if (components.length == 0)
-           return;
-
-       GridBagLayoutInfo info = getLayoutInfo (parent, PREFERREDSIZE);
-       if (info.cols == 0 && info.rows == 0)
-           return;
-       layoutInfo = info;
-
-       // DEBUG
-       //dumpLayoutInfo (layoutInfo);
-    
-       for(int i = 0; i < components.length; i++)
-       {
-           Component component = components [i];
-               
-           // If component is not visible we dont have to care about it.
-           if (!component.isVisible())
-               continue;
-               
-           GridBagConstraints constraints = lookupConstraints (component);
-
-           int cellx = sumIntArray(layoutInfo.colWidths, constraints.gridx);
-           int celly = sumIntArray(layoutInfo.rowHeights, constraints.gridy);
-           int cellw = sumIntArray(layoutInfo.colWidths,
-               constraints.gridx + constraints.gridwidth) - cellx;
-           int cellh = sumIntArray(layoutInfo.rowHeights,
-               constraints.gridy + constraints.gridheight) - celly;
-
-           Insets insets = constraints.insets;
-           if (insets != null)
-           {
-               cellx += insets.left;
-               celly += insets.top;
-               cellw -= insets.left + insets.right;
-               cellh -= insets.top + insets.bottom;
-           }
-
-           Dimension dim = component.preferredSize();
-
-           // Note: Documentation says that padding is added on both sides, but
-           // visual inspection shows that the Sun implementation only adds it
-           // once, so we do the same.
-           dim.width += constraints.ipadx;
-           dim.height += constraints.ipady;
-
-           switch(constraints.fill)
-           {
-               case GridBagConstraints.HORIZONTAL:
-                   dim.width = cellw;
-                   break;
-               case GridBagConstraints.VERTICAL:
-                   dim.height = cellh;
-                   break;
-               case GridBagConstraints.BOTH:
-                   dim.width = cellw;
-                   dim.height = cellh;
-                   break;
-           }
-
-           int x;
-           int y;
-
-           switch(constraints.anchor)
-           {
-               case GridBagConstraints.NORTH:
-                   x = cellx + (cellw - dim.width) / 2;
-                   y = celly;
-                   break;
-               case GridBagConstraints.SOUTH:
-                   x = cellx + (cellw - dim.width) / 2;
-                   y = celly + cellh - dim.height;
-                   break;
-               case GridBagConstraints.WEST:
-                   x = cellx;
-                   y = celly + (cellh - dim.height) / 2;
-                   break;
-               case GridBagConstraints.EAST:
-                   x = cellx + cellw - dim.width;
-                   y = celly + (cellh - dim.height) / 2;
-                   break;
-               case GridBagConstraints.NORTHEAST:
-                   x = cellx + cellw - dim.width;
-                   y = celly;
-                   break;
-               case GridBagConstraints.NORTHWEST:
-                   x = cellx;
-                   y = celly;
-                   break;
-               case GridBagConstraints.SOUTHEAST:
-                   x = cellx + cellw - dim.width;
-                   y = celly + cellh - dim.height;
-                   break;
-               case GridBagConstraints.SOUTHWEST:
-                   x = cellx;
-                   y = celly + cellh - dim.height;
-                   break;
-               default:
-                   x = cellx + (cellw - dim.width) / 2;
-                   y = celly + (cellh - dim.height) / 2;
-                   break;
-           }
-
-           component.setBounds(layoutInfo.pos_x + x, layoutInfo.pos_y + y, dim.width, dim.height);
-       }
-    
-       // DEBUG
-       //dumpLayoutInfo (layoutInfo);
-
+      ArrangeGrid (parent);
     }
 
     /**
@@ -521,160 +674,7 @@ public class GridBagLayout
      */
     protected GridBagLayoutInfo getLayoutInfo (Container parent, int sizeflag)
     {
-       if (sizeflag != MINSIZE && sizeflag != PREFERREDSIZE)
-           throw new IllegalArgumentException();
-
-       Dimension parentDim = parent.size();
-       Insets parentInsets = parent.insets();
-       parentDim.width -= parentInsets.left + parentInsets.right;
-       parentDim.height -= parentInsets.top + parentInsets.bottom;
-   
-       int x = 0;
-       int y = 0;
-       int max_x = 0;
-       int max_y = 0;
-
-       // first we figure out how many rows/columns
-       Component[] components = parent.getComponents();
-       for (int i = 0; i < components.length; i++)
-       {
-           Component component = components [i];
-               
-           // If component is not visible we dont have to care about it.
-           if (!component.isVisible())
-               continue;
-               
-           GridBagConstraints constraints = lookupConstraints (component);
-               
-           if(constraints.gridx == GridBagConstraints.RELATIVE)
-               constraints.gridx = x;
-
-           if(constraints.gridy == GridBagConstraints.RELATIVE)
-               constraints.gridy = y;
-               
-           max_x = Math.max(max_x, 
-               constraints.gridx + Math.max(1, constraints.gridwidth));
-           max_y = Math.max(max_y,
-               constraints.gridy + Math.max(1, constraints.gridheight));
-
-           if(constraints.gridwidth == GridBagConstraints.REMAINDER)
-           {
-               x = 0;
-               y++;
-           }
-           else
-           {
-               x = constraints.gridx + Math.max(1, constraints.gridwidth);
-               y = constraints.gridy;
-           }
-       }
-       
-       GridBagLayoutInfo info = new GridBagLayoutInfo(max_x, max_y);
-
-       for (x = 0; x <= max_x; x++)
-       {
-           if(columnWidths != null && columnWidths.length > x)
-           {
-               info.colWidths[x] = columnWidths[x];
-           }
-           if(columnWeights != null && columnWeights.length > x)
-           {
-               info.colWeights[x] = columnWeights[x];
-           }
-           for (int i = 0; i < components.length; i++)
-           {
-               Component component = components [i];
-                       
-               // If component is not visible we dont have to care about it.
-               if (!component.isVisible())
-                   continue;
-                       
-               GridBagConstraints constraints = lookupConstraints (component);
-
-               // first we fix up any REMAINDER cells
-               if(constraints.gridwidth == GridBagConstraints.REMAINDER)
-               {
-                   constraints.gridwidth = max_x - constraints.gridx;
-               }
-               if(constraints.gridheight == GridBagConstraints.REMAINDER)
-               {
-                   constraints.gridheight = max_y - constraints.gridy;
-               }
-
-               if(constraints.gridx + constraints.gridwidth - 1 == x)
-               {
-                   int width = (sizeflag == PREFERREDSIZE) ?
-                       component.preferredSize().width :
-                       component.minimumSize().width;
-                   if(constraints.insets != null)
-                   {
-                       width += constraints.insets.left + constraints.insets.right;
-                   }
-                   width += constraints.ipadx;
-                   for(int w = 1; w < constraints.gridwidth; w++)
-                   {
-                       width -= info.colWidths[x - w];
-                   }
-                   info.colWidths[x] = Math.max(info.colWidths[x], width);
-                   info.colWeights[x] =
-                       Math.max(info.colWeights[x], constraints.weightx);
-               }
-           }
-       }
-
-       for (y = 0; y <= max_y; y++)
-       {
-           if(rowHeights != null && rowHeights.length > y)
-           {
-               info.rowHeights[y] = rowHeights[y];
-           }
-           if(rowWeights != null && rowWeights.length > y)
-           {
-               info.rowWeights[y] = rowWeights[y];
-           }
-           for (int i = 0; i < components.length; i++)
-           {
-               Component component = components [i];
-                       
-               // If component is not visible we dont have to care about it.
-               if (!component.isVisible())
-                   continue;
-                       
-               GridBagConstraints constraints = lookupConstraints (component);
-
-               if(constraints.gridy + constraints.gridheight - 1 == y)
-               {
-                   int height = (sizeflag == PREFERREDSIZE) ?
-                       component.preferredSize().height :
-                       component.minimumSize().height;
-                   if(constraints.insets != null)
-                   {
-                       height += constraints.insets.top + constraints.insets.bottom;
-                   } 
-                   height += constraints.ipady;
-                   for(int h = 1; h < constraints.gridheight; h++)
-                   {
-                       height -= info.rowHeights[y - h];
-                   }
-                   info.rowHeights[y] = Math.max(info.rowHeights[y], height);
-                   info.rowWeights[y] =
-                       Math.max(info.rowWeights[y], constraints.weighty);
-               }
-           }
-       }
-
-       calcCellSizes (info.colWidths, info.colWeights, parentDim.width);
-       calcCellSizes (info.rowHeights, info.rowWeights, parentDim.height);
-
-       int totalWidth = sumIntArray(info.colWidths);
-       int totalHeight = sumIntArray(info.rowHeights);
-       info.pos_x = parentInsets.left + (parentDim.width - totalWidth) / 2;
-       info.pos_y = parentInsets.top + (parentDim.height - totalHeight) / 2;
-
-       // DEBUG
-       //dumpLayoutInfo (info);
-
-       return info;
+      return GetLayoutInfo (parent, sizeflag);
     }
 
     /**
@@ -682,7 +682,6 @@ public class GridBagLayout
      */
     protected void adjustForGravity (GridBagConstraints gbc, Rectangle rect)
     {
-       // FIXME
-       throw new Error ("Not implemented");
+      AdjustForGravity (gbc, rect);
     }
 }
index 418e4d886fbb9fdc1e325a9ecda310ee8c0397a9..802e25e664bb475eb50c566f9f931ead6f2b23e4 100644 (file)
@@ -52,12 +52,12 @@ public interface LayoutManager2 extends LayoutManager
 {
   /**
    * Adds the specified component to the layout, with the specified
-   * constraint object.
+   * constraints object.
    *
    * @param component the component to add
-   * @param constraint the constraint to satisfy
+   * @param constraints the constraints to satisfy
    */
-  void addLayoutComponent(Component component, Object contraint);
+  void addLayoutComponent(Component component, Object contraints);
 
   /**
    * Determines the maximum size of the specified target container.
index 79b2faa62994525d436324ae22050011b51c8c8e..47177edc7a0c438c1ff47ecc37028ebf68b9311a 100644 (file)
@@ -175,7 +175,7 @@ List(int rows, boolean multipleMode)
 public int
 getItemCount()
 {
-  return(items.size());
+  return countItems ();
 }
 
 /*************************************************************************/
@@ -191,7 +191,7 @@ getItemCount()
 public int
 countItems()
 {
-  return(getItemCount());
+  return items.size ();
 }
 
 /*************************************************************************/
@@ -249,7 +249,7 @@ getRows()
 public boolean
 isMultipleMode()
 {
-  return(multipleMode);
+  return allowsMultipleSelections ();
 }
 
 /*************************************************************************/
@@ -266,7 +266,7 @@ isMultipleMode()
 public boolean
 allowsMultipleSelections()
 {
-  return(multipleMode);
+  return multipleMode;
 }
 
 /*************************************************************************/
@@ -281,12 +281,7 @@ allowsMultipleSelections()
 public void
 setMultipleMode(boolean multipleMode)
 {
-  this.multipleMode = multipleMode;
-  if (peer != null)
-    {
-      ListPeer l = (ListPeer) peer;
-      l.setMultipleMode (multipleMode);
-    }
+  setMultipleSelections (multipleMode);
 }
 
 /*************************************************************************/
@@ -303,7 +298,11 @@ setMultipleMode(boolean multipleMode)
 public void
 setMultipleSelections(boolean multipleMode)
 {
-  setMultipleMode(multipleMode);
+  this.multipleMode = multipleMode;
+
+  ListPeer peer = (ListPeer) getPeer ();
+  if (peer != null)
+    peer.setMultipleMode (multipleMode);
 }
 
 /*************************************************************************/
@@ -316,7 +315,7 @@ setMultipleSelections(boolean multipleMode)
 public Dimension
 getMinimumSize()
 {
-  return(getMinimumSize(rows));
+  return getMinimumSize (getRows ());
 }
 
 /*************************************************************************/
@@ -332,7 +331,7 @@ getMinimumSize()
 public Dimension
 minimumSize()
 {
-  return(getMinimumSize(rows));
+  return minimumSize (getRows ());
 }
 
 /*************************************************************************/
@@ -348,11 +347,7 @@ minimumSize()
 public Dimension
 getMinimumSize(int rows)
 {
-  ListPeer lp = (ListPeer)getPeer();
-  if (lp != null)
-    return(lp.minimumSize(rows));
-  else
-    return(new Dimension(0,0));
+  return minimumSize (rows);
 }
 
 /*************************************************************************/
@@ -371,7 +366,11 @@ getMinimumSize(int rows)
 public Dimension
 minimumSize(int rows)
 {
-  return(getMinimumSize(rows));
+  ListPeer peer = (ListPeer) getPeer ();
+  if (peer != null)
+    return peer.minimumSize (rows);
+  else
+    return new Dimension (0, 0);
 }
 
 /*************************************************************************/
@@ -384,7 +383,7 @@ minimumSize(int rows)
 public Dimension
 getPreferredSize()
 {
-  return(getPreferredSize(rows));
+  return getPreferredSize (getRows ());
 }
 
 /*************************************************************************/
@@ -400,7 +399,7 @@ getPreferredSize()
 public Dimension
 preferredSize()
 {
-  return(getPreferredSize(rows));
+  return preferredSize (getRows ());
 }
 
 /*************************************************************************/
@@ -416,11 +415,7 @@ preferredSize()
 public Dimension
 getPreferredSize(int rows)
 {
-  ListPeer lp = (ListPeer)getPeer();
-  if (lp != null)
-    return(lp.preferredSize(rows));
-  else
-    return(new Dimension(0,0));
+  return preferredSize (rows);
 }
 
 /*************************************************************************/
@@ -439,7 +434,11 @@ getPreferredSize(int rows)
 public Dimension
 preferredSize(int rows)
 {
-  return(getPreferredSize(rows));
+  ListPeer peer = (ListPeer) getPeer ();
+  if (peer != null)
+    return peer.preferredSize (rows);
+  else
+    return new Dimension (0, 0);
 }
 
 /*************************************************************************/
@@ -452,7 +451,7 @@ preferredSize(int rows)
 public void
 add(String item)
 {
-  add(item, -1);
+  add (item, -1);
 }
 
 /*************************************************************************/
@@ -467,7 +466,7 @@ add(String item)
 public void
 addItem(String item)
 {
-  addItem(item, -1);
+  addItem (item, -1);
 }
 
 /*************************************************************************/
@@ -484,16 +483,7 @@ addItem(String item)
 public void
 add(String item, int index)
 {
-  if ((index == -1) || (index >= items.size()))
-    items.addElement(item);
-  else
-    items.insertElementAt(item, index);
-
-  if (peer != null)
-    {
-      ListPeer l = (ListPeer) peer;
-      l.add (item, index);
-    }
+  addItem (item, index);
 }
 
 /*************************************************************************/
@@ -512,7 +502,14 @@ add(String item, int index)
 public void
 addItem(String item, int index)
 {
-  add(item, index);
+  if ((index == -1) || (index >= items.size ()))
+    items.addElement (item);
+  else
+    items.insertElementAt (item, index);
+
+  ListPeer peer = (ListPeer) getPeer ();
+  if (peer != null)
+    peer.add (item, index);
 }
 
 /*************************************************************************/
@@ -529,7 +526,11 @@ addItem(String item, int index)
 public void
 delItem(int index) throws IllegalArgumentException
 {
-  remove(index);
+  items.removeElementAt (index);
+
+  ListPeer peer = (ListPeer) getPeer ();
+  if (peer != null)
+    peer.delItems (index, index);
 }
 
 /*************************************************************************/
@@ -544,12 +545,7 @@ delItem(int index) throws IllegalArgumentException
 public void
 remove(int index) throws IllegalArgumentException
 {
-  items.removeElementAt (index);
-  if (peer != null)
-    {
-      ListPeer l = (ListPeer) peer;
-      l.delItems (index, index);
-    }
+  delItem (index);
 }
 
 /*************************************************************************/
@@ -613,12 +609,7 @@ remove(String item) throws IllegalArgumentException
 public synchronized void
 removeAll()
 {
-  items.clear();
-  if (peer != null)
-    {
-      ListPeer l = (ListPeer) peer;
-      l.removeAll ();
-    }
+  clear ();
 }
 
 /*************************************************************************/
@@ -631,7 +622,11 @@ removeAll()
 public void
 clear()
 {
-  removeAll();
+  items.clear();
+
+  ListPeer peer = (ListPeer) getPeer ();
+  if (peer != null)
+    peer.removeAll ();
 }
 
 /*************************************************************************/
@@ -782,13 +777,7 @@ getSelectedObjects()
 public boolean
 isIndexSelected(int index)
 {
-  int[] indexes = getSelectedIndexes();
-
-  for (int i = 0; i < indexes.length; i++)
-    if (indexes[i] == index)
-      return(true);
-
-  return(false);
+  return isSelected (index);
 }
 
 /*************************************************************************/
@@ -807,7 +796,13 @@ isIndexSelected(int index)
 public boolean
 isSelected(int index)
 {
-  return(isIndexSelected(index));
+  int[] indexes = getSelectedIndexes ();
+
+  for (int i = 0; i < indexes.length; i++)
+    if (indexes[i] == index)
+      return true;
+
+  return false;
 }
 
 /*************************************************************************/
index 7fb2931184e65e8f2b816a386c9aa2048caed8ff..74478fbca75871f294cf967b363f20e58959ed73 100644 (file)
@@ -171,7 +171,7 @@ isTearOff()
 public int
 getItemCount()
 {
-  return(items.size());
+  return countItems ();
 }
 
 /**
@@ -183,7 +183,7 @@ getItemCount()
  */
 public int countItems ()
 {
-  return getItemCount ();
+  return items.size ();
 }
  
 /*************************************************************************/
index 9c278dfde0d4db80ac51e0b353bc3d5d0b4a5727..fb26729000846be1696a64cf55355c87aec8c954 100644 (file)
@@ -219,8 +219,7 @@ remove(MenuComponent menu)
 public int
 getMenuCount()
 {
-  // FIXME: How does the help menu fit in here?
-  return(menus.size());
+  return countMenus ();
 }
 
 /*************************************************************************/
@@ -235,7 +234,8 @@ getMenuCount()
 public int
 countMenus()
 {
-  return(getMenuCount());
+  // FIXME: How does the help menu fit in here?
+  return menus.size ();
 }
 
 /*************************************************************************/
index bea3b4fd477002df7bd5da671275a1dd20405aea..cfdfafcc881c0054a09479717961fa496a9864ab 100644 (file)
@@ -202,15 +202,7 @@ isEnabled()
 public synchronized void
 setEnabled(boolean enabled)
 {
-  if (enabled == this.enabled)
-    return;
-
-  this.enabled = enabled;
-  if (peer != null)
-    {
-      MenuItemPeer mp = (MenuItemPeer) peer;
-      mp.setEnabled (enabled);
-    }
+  enable (enabled);
 }
 
 /*************************************************************************/
@@ -226,7 +218,10 @@ setEnabled(boolean enabled)
 public void
 enable(boolean enabled)
 {
-  setEnabled(enabled);
+  if (enabled)
+    enable ();
+  else
+    disable ();
 }
 
 /*************************************************************************/
@@ -239,7 +234,12 @@ enable(boolean enabled)
 public void
 enable()
 {
-  setEnabled(true);
+  if (enabled)
+    return;
+
+  this.enabled = true;
+  if (peer != null)
+    ((MenuItemPeer) peer).setEnabled (true);
 }
 
 /*************************************************************************/
@@ -252,7 +252,12 @@ enable()
 public void
 disable()
 {
-  setEnabled(false);
+  if (!enabled)
+    return;
+
+  this.enabled = false;
+  if (peer != null)
+    ((MenuItemPeer) peer).setEnabled (false);
 }
 
 /*************************************************************************/
index 113dad992d2234f8ed68fac67967ba7d6f5db5cb..e91144c88121956289b6f32eb333a1db83e460ac 100644 (file)
@@ -257,11 +257,25 @@ public class Polygon implements Shape, Serializable
    * @since 1.1
    */
   public Rectangle getBounds()
+  {
+    return getBoundingBox ();
+  }
+
+  /**
+   * Returns the bounding box of this polygon. This is the smallest
+   * rectangle with sides parallel to the X axis that will contain this
+   * polygon.
+   *
+   * @return the bounding box for this polygon
+   * @see #getBounds2D()
+   * @deprecated use {@link #getBounds()} instead
+   */
+  public Rectangle getBoundingBox()
   {
     if (bounds == null)
       {
         if (npoints == 0)
-          return bounds = new Rectangle();
+          return bounds = new Rectangle ();
         int i = npoints - 1;
         int minx = xpoints[i];
         int maxx = minx;
@@ -280,25 +294,11 @@ public class Polygon implements Shape, Serializable
             else if (y > maxy)
               maxy = y;
           }
-        bounds = new Rectangle(minx, maxy, maxx - minx, maxy - miny);
+        bounds = new Rectangle (minx, maxy, maxx - minx, maxy - miny);
       }
     return bounds;
   }
 
-  /**
-   * Returns the bounding box of this polygon. This is the smallest
-   * rectangle with sides parallel to the X axis that will contain this
-   * polygon.
-   *
-   * @return the bounding box for this polygon
-   * @see #getBounds2D()
-   * @deprecated use {@link #getBounds()} instead
-   */
-  public Rectangle getBoundingBox()
-  {
-    return getBounds();
-  }
-
   /**
    * Tests whether or not the specified point is inside this polygon.
    *
index 48a2fbec0d4f71cb2ba78cf43610c56a4ae7d20f..c3340bb8eb4b6123d84a8dcf2a838c2e41a8874e 100644 (file)
@@ -281,10 +281,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
    */
   public void setBounds(Rectangle r)
   {
-    x = r.x;
-    y = r.y;
-    width = r.width;
-    height = r.height;
+    setBounds (r.x, r.y, r.width, r.height);
   }
 
   /**
@@ -298,10 +295,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
    */
   public void setBounds(int x, int y, int width, int height)
   {
-    this.x = x;
-    this.y = y;
-    this.width = width;
-    this.height = height;
+    reshape (x, y, width, height);
   }
 
   /**
@@ -333,7 +327,10 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
    */
   public void reshape(int x, int y, int width, int height)
   {
-    setBounds(x, y, width, height);
+    this.x = x;
+    this.y = y;
+    this.width = width;
+    this.height = height;
   }
 
   /**
@@ -360,8 +357,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
    */
   public void setLocation(Point p)
   {
-    this.x = p.x;
-    this.y = p.y;
+    setLocation (p.x, p.y);
   }
 
   /**
@@ -374,8 +370,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
    */
   public void setLocation(int x, int y)
   {
-    this.x = x;
-    this.y = y;
+    move (x, y);
   }
 
   /**
@@ -388,7 +383,8 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
    */
   public void move(int x, int y)
   {
-    setLocation(x, y);
+    this.x = x;
+    this.y = y;
   }
 
   /**
@@ -426,8 +422,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
    */
   public void setSize(Dimension d)
   {
-    width = d.width;
-    height = d.height;
+    setSize (d.width, d.height);
   }
 
   /**
@@ -439,8 +434,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
    */
   public void setSize(int width, int height)
   {
-    this.width = width;
-    this.height = height;
+    resize (width, height);
   }
 
   /**
@@ -452,7 +446,8 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
    */
   public void resize(int width, int height)
   {
-    setSize(width, height);
+    this.width = width;
+    this.height = height;
   }
 
   /**
@@ -469,9 +464,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
    */
   public boolean contains(Point p)
   {
-    return width > 0 && height > 0
-      && p.x >= x && p.x < x + width
-      && p.y >= y && p.y < y + height;
+    return contains (p.x, p.y);
   }
 
   /**
@@ -487,9 +480,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
    */
   public boolean contains(int x, int y)
   {
-    return width > 0 && height > 0
-      && x >= this.x && x < this.x + width
-      && y >= this.y && y < this.y + height;
+    return inside (x, y);
   }
 
   /**
@@ -504,9 +495,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
    */
   public boolean contains(Rectangle r)
   {
-    return width > 0 && height > 0 && r.width > 0 && r.height > 0
-      && r.x >= x && r.x + r.width <= x + width
-      && r.y >= y && r.y + r.height <= y + height;
+    return contains (r.x, r.y, r.width, r.height);
   }
 
   /**
@@ -537,7 +526,9 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
    */
   public boolean inside(int x, int y)
   {
-    return contains(x, y);
+    return width > 0 && height > 0
+      && x >= this.x && x < this.x + width
+      && y >= this.y && y < this.y + height;
   }
 
   /**
index 937568a6204f69d8be8209db797773e48ab756ae..b772bee3878e090e687cd41853ca29bf0a842514 100644 (file)
@@ -446,10 +446,25 @@ removeNotify()
 public void
 doLayout()
 {
-  Component[] list = getComponents();
+  layout ();
+}
+
+/*************************************************************************/
+
+/**
+  * Lays out this component.  This consists of resizing the sole child
+  * component to its perferred size.
+  *
+  * @deprecated This method is deprecated in favor of
+  * <code>doLayout()</code>.
+  */
+public void
+layout()
+{
+  Component[] list = getComponents ();
   if ((list != null) && (list.length > 0))
     {
-      Dimension dim = list[0].getPreferredSize();
+      Dimension dim = list[0].getPreferredSize ();
       Dimension vp = getViewportSize ();
 
       if (dim.width < vp.width)
@@ -462,35 +477,20 @@ doLayout()
       if (peer != null)
        peer.childResized (dim.width, dim.height);
 
-      list[0].resize (dim);
+      list[0].setSize (dim);
 
-      Point p = getScrollPosition();
+      Point p = getScrollPosition ();
       if (p.x > dim.width)
         p.x = dim.width;
       if (p.y > dim.height)
         p.y = dim.height;
 
-      setScrollPosition(p);
+      setScrollPosition (p);
     }
 }
 
 /*************************************************************************/
 
-/**
-  * Lays out this component.  This consists of resizing the sole child
-  * component to its perferred size.
-  *
-  * @deprecated This method is deprecated in favor of
-  * <code>doLayout()</code>.
-  */
-public void
-layout()
-{
-  doLayout();
-}
-
-/*************************************************************************/
-
 /**
   * This method overrides its superclass method to ensure no layout
   * manager is set for this container.  <code>ScrollPane</code>'s do
index 85ac117e683c2942be69bba49878ffbca954e8c7..79b2e439ea14cf3a5d19c7919dee4e013fb72bc9 100644 (file)
@@ -333,7 +333,7 @@ setMinimum(int minimum)
 public int
 getVisibleAmount()
 {
-  return(visibleAmount);
+  return getVisible ();
 }
 
 /*************************************************************************/
@@ -350,7 +350,7 @@ getVisibleAmount()
 public int
 getVisible()
 {
-  return(getVisibleAmount());
+  return visibleAmount;
 }
 
 /*************************************************************************/
@@ -438,7 +438,7 @@ setValues(int value, int visibleAmount, int minimum, int maximum)
 public int
 getUnitIncrement()
 {
-  return(lineIncrement);
+  return getLineIncrement ();
 }
 
 /*************************************************************************/
@@ -455,7 +455,7 @@ getUnitIncrement()
 public int
 getLineIncrement()
 {
-  return(lineIncrement);
+  return lineIncrement;
 }
 
 /*************************************************************************/
@@ -469,26 +469,7 @@ getLineIncrement()
 public synchronized void
 setUnitIncrement(int unitIncrement)
 {
-  if (unitIncrement < 0)
-    throw new IllegalArgumentException("Unit increment less than zero.");
-
-  int range = maximum - minimum;
-  if (unitIncrement > range)
-    {
-      if (range == 0)
-        unitIncrement = 1;
-      else
-        unitIncrement = range;
-    }
-
-  if (unitIncrement == lineIncrement)
-    return;
-
-  lineIncrement = unitIncrement;
-
-  ScrollbarPeer sp = (ScrollbarPeer)getPeer();
-  if (sp != null)
-    sp.setLineIncrement(lineIncrement);
+  setLineIncrement (unitIncrement);
 }
 
 /*************************************************************************/
@@ -505,7 +486,26 @@ setUnitIncrement(int unitIncrement)
 public void
 setLineIncrement(int lineIncrement)
 {
-  setUnitIncrement(lineIncrement);
+  if (lineIncrement < 0)
+    throw new IllegalArgumentException ("Unit increment less than zero.");
+
+  int range = maximum - minimum;
+  if (lineIncrement > range)
+    {
+      if (range == 0)
+        lineIncrement = 1;
+      else
+        lineIncrement = range;
+    }
+
+  if (lineIncrement == this.lineIncrement)
+    return;
+
+  this.lineIncrement = lineIncrement;
+
+  ScrollbarPeer sp = (ScrollbarPeer) getPeer ();
+  if (sp != null)
+    sp.setLineIncrement (this.lineIncrement);
 }
 
 /*************************************************************************/
@@ -519,7 +519,7 @@ setLineIncrement(int lineIncrement)
 public int
 getBlockIncrement()
 {
-  return(pageIncrement);
+  return getPageIncrement ();
 }
 
 /*************************************************************************/
@@ -536,7 +536,7 @@ getBlockIncrement()
 public int
 getPageIncrement()
 {
-  return(pageIncrement);
+  return pageIncrement;
 }
 
 /*************************************************************************/
@@ -550,26 +550,7 @@ getPageIncrement()
 public synchronized void
 setBlockIncrement(int blockIncrement)
 {
-  if (blockIncrement < 0)
-    throw new IllegalArgumentException("Block increment less than zero.");
-
-  int range = maximum - minimum;
-  if (blockIncrement > range)
-    {
-      if (range == 0)
-        blockIncrement = 1;
-      else
-        blockIncrement = range;
-    }
-
-  if (blockIncrement == pageIncrement)
-    return;
-
-  pageIncrement = blockIncrement;
-
-  ScrollbarPeer sp = (ScrollbarPeer)getPeer();
-  if (sp != null)
-    sp.setPageIncrement(pageIncrement);
+  setPageIncrement (blockIncrement);
 }
 
 /*************************************************************************/
@@ -586,7 +567,26 @@ setBlockIncrement(int blockIncrement)
 public void
 setPageIncrement(int pageIncrement)
 {
-  setBlockIncrement(pageIncrement);
+  if (pageIncrement < 0)
+    throw new IllegalArgumentException ("Block increment less than zero.");
+
+  int range = maximum - minimum;
+  if (pageIncrement > range)
+    {
+      if (range == 0)
+        pageIncrement = 1;
+      else
+        pageIncrement = range;
+    }
+
+  if (pageIncrement == this.pageIncrement)
+    return;
+
+  this.pageIncrement = pageIncrement;
+
+  ScrollbarPeer sp = (ScrollbarPeer) getPeer ();
+  if (sp != null)
+    sp.setPageIncrement (this.pageIncrement);
 }
 
 /*************************************************************************/
index 356efeb921dbaa2582e84020915370c61c358119..6f60ee69c2f784745b398e05689e082a33528d19 100644 (file)
@@ -288,13 +288,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
    */
   public Dimension getMinimumSize (int rows, int columns)
   {
-    TextAreaPeer peer = (TextAreaPeer) getPeer ();
-
-    // Sun returns Dimension (0,0) in this case.
-    if (peer == null)
-      return new Dimension (0, 0);
-
-    return peer.getMinimumSize (rows, columns);
+    return minimumSize (rows, columns);
   }
 
   /**
@@ -311,7 +305,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
    */
   public Dimension minimumSize ()
   {
-    return getMinimumSize (getRows (), getColumns ());
+    return minimumSize (getRows (), getColumns ());
   }
 
   /**
@@ -333,7 +327,13 @@ public class TextArea extends TextComponent implements java.io.Serializable
    */
   public Dimension minimumSize (int rows, int columns)
   {
-    return getMinimumSize (rows, columns);
+    TextAreaPeer peer = (TextAreaPeer) getPeer ();
+
+    // Sun returns Dimension (0,0) in this case.
+    if (peer == null)
+      return new Dimension (0, 0);
+
+    return peer.getMinimumSize (rows, columns);
   }
 
   /**
@@ -366,13 +366,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
    */
   public Dimension getPreferredSize (int rows, int columns)
   {
-    TextAreaPeer peer = (TextAreaPeer) getPeer ();
-
-    // Sun returns Dimension (0,0) in this case.
-    if (peer == null)
-      return new Dimension (0, 0);
-
-    return peer.getPreferredSize (rows, columns);
+    return preferredSize (rows, columns);
   }
 
   /**
@@ -389,7 +383,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
    */
   public Dimension preferredSize ()
   {
-    return getPreferredSize (getRows (), getColumns ());
+    return preferredSize (getRows (), getColumns ());
   }
 
   /**
@@ -411,7 +405,13 @@ public class TextArea extends TextComponent implements java.io.Serializable
    */
   public Dimension preferredSize (int rows, int columns)
   {
-    return getPreferredSize (rows, columns);
+    TextAreaPeer peer = (TextAreaPeer) getPeer ();
+
+    // Sun returns Dimension (0,0) in this case.
+    if (peer == null)
+      return new Dimension (0, 0);
+
+    return peer.getPreferredSize (rows, columns);
   }
 
   /**
@@ -440,59 +440,59 @@ public class TextArea extends TextComponent implements java.io.Serializable
   /**
    * Append the specified text to the end of the current text.
    *
-   * @param text The text to append.
+   * @param str The text to append.
    */
   public void append (String str)
   {
-    TextAreaPeer peer = (TextAreaPeer) getPeer ();
-    if (peer == null)
-      return;
-
-    peer.insert (str, peer.getText().length ());
+    appendText (str);
   }
 
   /**
    * Append the specified text to the end of the current text.
    *
-   * @param text The text to append.
+   * @param str The text to append.
    *
    * @deprecated This method is deprecated in favor of
    * <code>append ()</code>.
    */
-  public void appendText (String text)
+  public void appendText (String str)
   {
-    append (text);
+    TextAreaPeer peer = (TextAreaPeer) getPeer ();
+    if (peer == null)
+      return;
+
+    peer.insert (str, peer.getText().length ());
   }
 
   /**
    * Insert the specified text at the specified position.  The first
    * character in the text area is at position zero.
    *
-   * @param text The text to insert.
+   * @param str The text to insert.
    * @param pos The position at which to insert text.
    */
-  public void insert (String text, int pos)
+  public void insert (String str, int pos)
   {
-    TextAreaPeer peer = (TextAreaPeer) getPeer ();
-    if (peer == null)
-      return;
-
-    peer.insert (text, pos);
+    insertText (str, pos);
   }
 
   /**
    * Insert the specified text at the specified position.  The first
    * character in the text area is at position zero.
    *
-   * @param text The text to insert.
+   * @param str The text to insert.
    * @param pos The position at which to insert text.
    *
-   * @deprecated This method is depcreated in favor of
+   * @deprecated This method is deprecated in favor of
    * <code>insert ()</code>.
    */
-  public void insertText (String text, int pos)
+  public void insertText (String str, int pos)
   {
-    insert (text, pos);
+    TextAreaPeer peer = (TextAreaPeer) getPeer ();
+    if (peer == null)
+      return;
+
+    peer.insert (str, pos);
   }
 
   /**
@@ -503,17 +503,13 @@ public class TextArea extends TextComponent implements java.io.Serializable
    * length of the replacement text may differ from the length of the
    * text that is replaced.
    *
-   * @param text The new text for the range.
+   * @param str The new text for the range.
    * @param start The start position of the replacement range.
    * @param end The end position of the replacement range.
    */
-  public void replaceRange (String text, int start, int end)
+  public void replaceRange (String str, int start, int end)
   {
-    TextAreaPeer peer = (TextAreaPeer) getPeer ();
-    if (peer == null)
-      return;
-
-    peer.replaceRange (text, start, end);
+    replaceText (str, start, end);
   }
 
   /**
@@ -524,16 +520,20 @@ public class TextArea extends TextComponent implements java.io.Serializable
    * length of the replacement text may differ from the length of the
    * text that is replaced.
    *
-   * @param text The new text for the range.
+   * @param str The new text for the range.
    * @param start The start position of the replacement range.
    * @param end The end position of the replacement range.
    *
    * @deprecated This method is deprecated in favor of
    * <code>replaceRange ()</code>.
    */
-  public void replaceText (String text, int start, int end)
+  public void replaceText (String str, int start, int end)
   {
-    replaceRange (text, start, end);
+    TextAreaPeer peer = (TextAreaPeer) getPeer ();
+    if (peer == null)
+      return;
+
+    peer.replaceRange (str, start, end);
   }
 
   /**
index 7575e24d4c1df0f9dd9bd0a5f613bb25dcc67ab0..1a783e27a79ca07a60e3ae2c6b89dc0ad30a5a06 100644 (file)
@@ -212,11 +212,7 @@ getEchoChar()
 public void
 setEchoChar(char echoChar)
 {
-  this.echoChar = echoChar;
-
-  TextFieldPeer tfp = (TextFieldPeer)getPeer();
-  if (tfp != null)
-    tfp.setEchoChar(echoChar);
+  setEchoCharacter (echoChar);
 }
 
 /*************************************************************************/
@@ -233,7 +229,11 @@ setEchoChar(char echoChar)
 public void
 setEchoCharacter(char echoChar)
 {
-  setEchoChar(echoChar);
+  this.echoChar = echoChar;
+
+  TextFieldPeer peer = (TextFieldPeer) getPeer ();
+  if (peer != null)
+    peer.setEchoChar (echoChar);
 }
 
 /*************************************************************************/
@@ -264,7 +264,7 @@ echoCharIsSet()
 public Dimension
 getMinimumSize()
 {
-  return(getMinimumSize(getColumns()));
+  return getMinimumSize (getColumns ());
 }
 
 /*************************************************************************/
@@ -278,11 +278,7 @@ getMinimumSize()
 public Dimension
 getMinimumSize(int columns)
 {
-  TextFieldPeer tfp = (TextFieldPeer)getPeer();
-  if (tfp == null)
-    return(null); // FIXME: What do we do if there is no peer?
-
-  return(tfp.getMinimumSize(columns));
+  return minimumSize (columns);
 }
 
 /*************************************************************************/
@@ -292,13 +288,13 @@ getMinimumSize(int columns)
   *
   * @return The minimum size for this text field.
   *
-  * @deprecated This method is depcreated in favor of
+  * @deprecated This method is deprecated in favor of
   * <code>getMinimumSize()</code>.
   */
 public Dimension
 minimumSize()
 {
-  return(getMinimumSize(getColumns()));
+  return minimumSize (getColumns ());
 }
 
 /*************************************************************************/
@@ -315,7 +311,11 @@ minimumSize()
 public Dimension
 minimumSize(int columns)
 {
-  return(getMinimumSize(columns));
+  TextFieldPeer peer = (TextFieldPeer) getPeer ();
+  if (peer == null)
+    return null; // FIXME: What do we do if there is no peer?
+
+  return peer.getMinimumSize (columns);
 }
 
 /*************************************************************************/
@@ -328,7 +328,7 @@ minimumSize(int columns)
 public Dimension
 getPreferredSize()
 {
-  return(getPreferredSize(getColumns()));
+  return getPreferredSize (getColumns ());
 }
 
 /*************************************************************************/
@@ -342,12 +342,7 @@ getPreferredSize()
 public Dimension
 getPreferredSize(int columns)
 {
-  TextFieldPeer tfp = (TextFieldPeer)getPeer();
-  if (tfp == null)
-    {
-      return new Dimension(0, 0);
-    }
-  return(tfp.getPreferredSize(columns));
+  return preferredSize (columns);
 }
 
 /*************************************************************************/
@@ -363,7 +358,7 @@ getPreferredSize(int columns)
 public Dimension
 preferredSize()
 {
-  return(getPreferredSize(getColumns()));
+  return preferredSize (getColumns ());
 }
 
 /*************************************************************************/
@@ -380,7 +375,11 @@ preferredSize()
 public Dimension
 preferredSize(int columns)
 {
-  return(getPreferredSize(columns));
+  TextFieldPeer peer = (TextFieldPeer) getPeer ();
+  if (peer == null)
+    return new Dimension (0, 0);
+
+  return peer.getPreferredSize (columns);
 }
 
 /*************************************************************************/
index eca35ed66ac74ba8d965f2c9b50e4376491589c2..81d84a45e562564731a8498968076c2d61a8509a 100644 (file)
@@ -87,24 +87,24 @@ public class RenderContext implements Cloneable
 
   public void preConcatenateTransform(AffineTransform pre)
   {
-    xform.preConcatenate(pre);
+    preConcetenateTransform (pre);
   }
 
-  /** @deprecated Sun can't spell concatenate */
+  /** @deprecated */
   public void preConcetenateTransform(AffineTransform pre)
   {
-    preConcetenateTransform(pre);
+    xform.preConcatenate (pre);
   }
 
   public void concatenateTransform(AffineTransform post)
   {
-    xform.concatenate(post);
+    concetenateTransform (post);
   }
 
-  /** @deprecated Sun can't spell concatenate */
+  /** @deprecated */
   public void concetenateTransform(AffineTransform post)
   {
-    concatenateTransform(post);
+    xform.concatenate (post);
   }
 
   public AffineTransform getTransform()
index ed450ced7a5f6cf2f33ea975203298e52c6e5484..82976d38c7b49a6c85703ea77de847b5b3b4bf39 100644 (file)
@@ -80,7 +80,7 @@ public class JApplet extends Applet
   public Dimension getPreferredSize()
   {
     Dimension d = super.getPreferredSize();
-    System.out.println("JFrame.getPrefSize(): " + d + " , comp="+countComponents() + ", layout=" + getLayout());
+    System.out.println("JFrame.getPrefSize(): " + d + " , comp="+ getComponentCount () + ", layout=" + getLayout());
     return d;
   }