Microsoft KB Archive/189066

= FIX: BorderLayout: Cannot Add To Layout: Unknown Constraint =

Article ID: 189066

Article Last Modified on 10/20/2003

-

APPLIES TO


 * Microsoft Visual J++ 1.0 Standard Edition
 * Microsoft Visual J++ 1.1 Standard Edition

-



This article was previously published under Q189066



SYMPTOMS
Trying to add a component using the BorderLayout as follows f.add(button,BorderLayout.CENTER) generates the following message when trying to execute the Java Application:

BorderLayout: Cannot add to layout : unknown constraint: Center



RESOLUTION
This problem is fixed with the Jvc.exe that ships with the SDK for Java versions 2.0x and later.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been corrected in the Jvc.exe that ships with the SDK for Java version 2.0x and later.



Steps to Reproduce Behavior
  Create a Java Application as follows: import java.awt.*; import java.awt.event.*; import java.util.*;

public class test {        public static void main(String args[]) {           Frame f = new Frame; f.setLayout(new BorderLayout); Button b1=new Button; f.add(b1,BorderLayout.CENTER); System.out.println(">"+BorderLayout.CENTER+"<"); System.out.println(">"+BorderLayout.WEST+"<"); System.out.println(">"+BorderLayout.EAST+"<"); System.out.println(">"+BorderLayout.NORTH+"<"); System.out.println(">"+BorderLayout.SOUTH+"<"); }     }                         If you compile this using Jvc.exe, which ships with Visual J++ 1.x, you will see the above mentioned message when trying to execute this application.

-or-

If you are running this as an applet, you will notice that the components do not appear in the Browser. To fix the problem, try compiling the sample above with the Jvc.exe file that ships with the SDK for Java 2.0x and later.

