日期:2014-05-20  浏览次数:20662 次

麻烦向各位大师问一下:我编的这个LayoutUtil.java源文件有什么错误?
源程序:
package   edu.njust.cs;

import   javax.swing.*;
import   java.awt.*;

public   class   LayoutUtil{
public   static   void   add(Container   con,int   fill,int   anchor,int   weightx,int   weighty,int   x,int   y,   int   width,int   height,Component   comp)
{
GridBagConstraints   constraints=new   GridBagConstraints();

constraints.fill=fill;
constraints.anchor=anchor;
constraints.weightx=weightx;
constraints.weighty=weighty;
constraints.gridx=x;
constraints.gridy=y;
constraints.gridwidth=width;
constraints.gridheight=height;
con.add(comp,constraints);
}
public   static   void   add(Container   con,int   fill,int   anchor,int   weightx,int   weighty,int   x,int   y,int   width,int   height,Component   comp,Insets   in){
GridBagConstraints   constraints=new   GridBagConstraints();
constraints.insets=in;
constraints.fill=fill;
constraints.anchor=anchor;
constraints.weightx=weightx;
constraints.weighty=weighty;
constraints.gridx=x;
constraints.gridy=y;;
constraints.gridwidth=width;
constraints.gridheight=height;
con.add(comp,constraints);
}
}

这个是运行结果的抓图http://w3.886.cn/4tLN/21741701/21741701_9427.jpg

------解决方案--------------------
顶了!