From 65bf3316cf384588453604be6b4f0ed3751a8b0f Mon Sep 17 00:00:00 2001 From: tromey Date: Tue, 9 Jan 2007 19:58:05 +0000 Subject: Merged gcj-eclipse branch to trunk. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120621 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/classpath/java/awt/GridBagLayout.java | 34 +++++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'libjava/classpath/java/awt/GridBagLayout.java') diff --git a/libjava/classpath/java/awt/GridBagLayout.java b/libjava/classpath/java/awt/GridBagLayout.java index d84b7d6df6c..0415c7bd3bb 100644 --- a/libjava/classpath/java/awt/GridBagLayout.java +++ b/libjava/classpath/java/awt/GridBagLayout.java @@ -46,6 +46,7 @@ import java.util.Hashtable; /** * @author Michael Koch (konqueror@gmx.de) * @author Jeroen Frijters (jeroen@frijters.net) + * @author Andrew John Hughes (gnu_andrew@member.fsf.org) */ public class GridBagLayout implements Serializable, LayoutManager2 @@ -62,8 +63,8 @@ public class GridBagLayout // REMAINDER constraints. // Constraints kept in comptable are never modified, and constraints // kept in internalcomptable can be modified internally only. - protected Hashtable comptable; - private Hashtable internalcomptable; + protected Hashtable comptable; + private Hashtable internalcomptable; protected GridBagLayoutInfo layoutInfo; protected GridBagConstraints defaultConstraints; @@ -74,8 +75,8 @@ public class GridBagLayout public GridBagLayout () { - this.comptable = new Hashtable(); - this.internalcomptable = new Hashtable(); + this.comptable = new Hashtable(); + this.internalcomptable = new Hashtable(); this.defaultConstraints= new GridBagConstraints(); } @@ -319,6 +320,16 @@ public class GridBagLayout return new Point (col, row); } + /** + * Return a string representation of this GridBagLayout. + * + * @return a string representation + */ + public String toString() + { + return getClass().getName(); + } + /** * Move and resize a rectangle according to a set of grid bag * constraints. The x, y, width and height fields of the @@ -489,16 +500,18 @@ public class GridBagLayout // Guaranteed to contain the last component added to the given row // or column, whose gridwidth/height is not REMAINDER. - HashMap lastInRow = new HashMap(); - HashMap lastInCol = new HashMap(); + HashMap lastInRow = new HashMap(); + HashMap lastInCol = new HashMap(); Component[] components = parent.getComponents(); // Components sorted by gridwidths/heights, // smallest to largest, with REMAINDER and RELATIVE at the end. // These are useful when determining sizes and weights. - ArrayList sortedByWidth = new ArrayList(components.length); - ArrayList sortedByHeight = new ArrayList(components.length); + ArrayList sortedByWidth = + new ArrayList(components.length); + ArrayList sortedByHeight = + new ArrayList(components.length); // STEP 1: first we figure out how many rows/columns for (int i = 0; i < components.length; i++) @@ -763,7 +776,7 @@ public class GridBagLayout // STEP 3: Determine sizes and weights for columns. for (int i = 0; i < sortedByWidth.size(); i++) { - Component component = (Component) sortedByWidth.get(i); + Component component = sortedByWidth.get(i); // If component is not visible we dont have to care about it. if (!component.isVisible()) @@ -877,7 +890,8 @@ public class GridBagLayout * width. Otherwise, sort by height. * FIXME: Use a better sorting algorithm. */ - private void sortBySpan (Component component, int span, ArrayList list, boolean sortByWidth) + private void sortBySpan (Component component, int span, + ArrayList list, boolean sortByWidth) { if (span == GridBagConstraints.REMAINDER || span == GridBagConstraints.RELATIVE) -- cgit v1.2.3