From 0e485bf7ae2fd939ed061cd835f5752e30931e4d Mon Sep 17 00:00:00 2001
From: graydon <graydon@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 7 Jan 2004 00:11:51 +0000
Subject: [PATCH] 2004-01-06  Graydon Hoare  <graydon@redhat.com>

	* java/awt/Container.java (swapComponents): Add forgotten
	function, required for JLayeredPane change.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75491 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libjava/ChangeLog               |  5 +++++
 libjava/java/awt/Container.java | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 3750a46c8e14..02562e5a75df 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-06  Graydon Hoare  <graydon@redhat.com>
+
+	* java/awt/Container.java (swapComponents): Add forgotten
+	function, required for JLayeredPane change.
+
 2004-01-06  Michael Koch  <konqueror@gmx.de>
 
 	* java/text/CollationElementIterator.java: Reformated.
diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java
index e96b13d4bb5a..ad43ce41a920 100644
--- a/libjava/java/awt/Container.java
+++ b/libjava/java/awt/Container.java
@@ -158,6 +158,25 @@ public class Container extends Component
       }
   }
 
+  /**
+   * Swaps the components at position i and j, in the container.
+   */
+
+  protected void swapComponents (int i, int j)
+  {   
+    synchronized (getTreeLock ())
+      {
+        if (i < 0 
+            || i >= component.length
+            || j < 0 
+            || j >= component.length)
+          throw new ArrayIndexOutOfBoundsException ();
+        Component tmp = component[i];
+        component[i] = component[j];
+        component[j] = tmp;
+      }
+  }
+
   /**
    * Returns the insets for this container, which is the space used for
    * borders, the margin, etc.
-- 
GitLab