Removing kaffeisms from java.awt.BorderLayout

Pavel Roskin pavel_roskin at geocities.com
Fri Jun 18 00:22:48 PDT 1999


Hello!

java.awt.Component doesn't have field "flags" in JDK-1.1.7

This field should ideally be private in Kaffe. It would, however, require
rather serious changes,

What about java.awt.BorderLayout, I think that layout managers should be
as portable as possible. I see no reason for them to use Kaffe specific
extensions.

One could use Kaffe's layout managers with other VM's and tailor them for
specific needs.

The patch is attached.

Pavel Roskin
-------------- next part --------------
Index: libraries/javalib/java/awt/BorderLayout.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/awt/BorderLayout.java,v
retrieving revision 1.6
diff -u -r1.6 BorderLayout.java
--- BorderLayout.java	1999/03/24 07:56:18	1.6
+++ BorderLayout.java	1999/06/18 07:15:29
@@ -150,27 +150,27 @@
 
 	// watch out - JDK seems to bypass isVisible() (which might be resolved, e.g. by Swing)
 
-	if ( (north != null) && ((north.flags & Component.IS_VISIBLE) != 0) ) {
+	if ( (north != null) && (north.isVisible()) ) {
 		pd = north.getPreferredSize();
 		north.setBounds(left, top, right - left, pd.height);
 		top += pd.height + vGap;
 	}
-	if ((south != null) && ((south.flags & Component.IS_VISIBLE) != 0) ) {
+	if ((south != null) && (south.isVisible()) ) {
 		pd = south.getPreferredSize();
 		south.setBounds(left, bottom - pd.height, right - left, pd.height);
 		bottom -= pd.height + vGap;
 	}
-	if ((east != null) && ((east.flags & Component.IS_VISIBLE) != 0) ) {
+	if ((east != null) && (east.isVisible()) ) {
 		pd = east.getPreferredSize();
 		east.setBounds(right - pd.width, top, pd.width, bottom - top);
 		right -= pd.width + hGap;
 	}
-	if ((west != null) && ((west.flags & Component.IS_VISIBLE) != 0) ) {
+	if ((west != null) && (west.isVisible()) ) {
 		pd = west.getPreferredSize();
 		west.setBounds(left, top, pd.width, bottom - top);
 		left += pd.width + hGap;
 	}
-	if ((center != null) && ((center.flags & Component.IS_VISIBLE) != 0) )
+	if ((center != null) && (center.isVisible()) )
 		center.setBounds(left, top, right - left, bottom - top);
 }
 
@@ -198,27 +198,27 @@
 
 	// watch out - JDK seems to ignore isVisible() (might be resolved, e.g. by swing)
 
-	if ((east != null) && ((east.flags & Component.IS_VISIBLE) != 0) ) {
+	if ((east != null) && (east.isVisible()) ) {
 		md = east.getMinimumSize();
 		d.width += md.width + hGap;
 		d.height = Math.max( md.height, d.height);
 	}
-	if ((west != null) && ((west.flags & Component.IS_VISIBLE) != 0) ){
+	if ((west != null) && (west.isVisible()) ) {
 		md = west.getMinimumSize();
 		d.width += md.width + hGap;
 		d.height = Math.max( md.height, d.height);
 	}
-	if ((center != null) && ((center.flags & Component.IS_VISIBLE) != 0) ){
+	if ((center != null) && (center.isVisible()) ) {
 		md = center.getMinimumSize();
 		d.width += md.width;
 		d.height = Math.max( md.height, d.height);
 	}
-	if ((north != null) && ((north.flags & Component.IS_VISIBLE) != 0) ){
+	if ((north != null) && (north.isVisible()) ) {
 		md = north.getMinimumSize();
 		d.width = Math.max( md.width, d.width);
 		d.height += md.height + vGap;
 	}
-	if ((south != null) && ((south.flags & Component.IS_VISIBLE) != 0) ) {
+	if ((south != null) && (south.isVisible()) ) {
 		md = south.getMinimumSize();
 		d.width = Math.max( md.width, d.width);
 		d.height += md.height + vGap;
@@ -243,27 +243,27 @@
 
 	// watch out - JDK seems to ignore setVisible() (which might be resolved, e.g. by swing)
 
-	if ((east != null) && ((east.flags & Component.IS_VISIBLE) != 0) ) {
+	if ((east != null) && (east.isVisible()) ) {
 		pd = east.getPreferredSize();
 		d.width += pd.width + hGap;
 		d.height = Math.max( pd.height, d.height);
 	}
-	if ((west != null) && ((west.flags & Component.IS_VISIBLE) != 0) ) {
+	if ((west != null) && (west.isVisible()) ) {
 		pd = west.getPreferredSize();
 		d.width += pd.width + hGap;
 		d.height = Math.max( pd.height, d.height);
 	}
-	if ((center != null) && ((center.flags & Component.IS_VISIBLE) != 0) ) {
+	if ((center != null) && (center.isVisible()) ) {
 		pd = center.getPreferredSize();
 		d.width += pd.width;
 		d.height = Math.max( pd.height, d.height);
 	}
-	if ((north != null) && ((north.flags & Component.IS_VISIBLE) != 0) ) {
+	if ((north != null) && (north.isVisible()) ) {
 		pd = north.getPreferredSize();
 		d.width = Math.max( pd.width, d.width);
 		d.height += pd.height + vGap;
 	}
-	if ((south != null) && ((south.flags & Component.IS_VISIBLE) != 0) ){
+	if ((south != null) && (south.isVisible()) ) {
 		pd = south.getPreferredSize();
 		d.width = Math.max( pd.width, d.width);
 		d.height += pd.height + vGap;


More information about the kaffe mailing list