This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: AWT fixes


I'm checking this in.

This fixes a couple layout bugs in AWT.
With this patch, the TestAWT program now shows all its buttons, and
clicking the Close button works.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* java/awt/GridLayout.java (layoutContainer): Use number of rows
	to compute height of each cell, and number of columns to compute
	width of each cell.
	* java/awt/Window.java (getOwnedWindows): Don't return null.
	* java/awt/FlowLayout.java (layoutContainer): Set width and height
	of component.  Increment x using horizontal gap, not vertical
	gap.

Index: java/awt/FlowLayout.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/FlowLayout.java,v
retrieving revision 1.6
diff -u -r1.6 FlowLayout.java
--- java/awt/FlowLayout.java 2002/01/25 17:25:26 1.6
+++ java/awt/FlowLayout.java 2002/01/29 16:29:13
@@ -212,8 +212,8 @@
 	    if (comps[k].visible)
 	      {
 		Dimension c = comps[k].getPreferredSize ();
-		comps[k].setLocation (x, y);
-		x += c.width + vgap;
+		comps[k].setBounds (x, y, c.width, new_h);
+		x += c.width + hgap;
 	      }
 	  }
 
Index: java/awt/GridLayout.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/GridLayout.java,v
retrieving revision 1.5
diff -u -r1.5 GridLayout.java
--- java/awt/GridLayout.java 2002/01/25 17:25:26 1.5
+++ java/awt/GridLayout.java 2002/01/29 16:29:13
@@ -172,9 +172,9 @@
 
     // Compute width and height of each cell in the grid.
     int tw = d.width - ins.left - ins.right;
-    tw = (tw - (real_rows - 1) * hgap) / real_rows;
+    tw = (tw - (real_cols - 1) * hgap) / real_cols;
     int th = d.height - ins.top - ins.bottom;
-    th = (th - (real_cols - 1) * vgap) / real_cols;
+    th = (th - (real_rows - 1) * vgap) / real_rows;
 
     // If the cells are too small, still try to do something.
     if (tw < 0)
Index: java/awt/Window.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Window.java,v
retrieving revision 1.11
diff -u -r1.11 Window.java
--- java/awt/Window.java 2002/01/22 22:40:05 1.11
+++ java/awt/Window.java 2002/01/29 16:29:14
@@ -303,7 +303,7 @@
   {
     // FIXME: return array containing all the windows this window currently 
     // owns.
-    return null;
+    return new Window[0];
   }
 
   /**


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]