Java 使用网格组布局重叠了
GridBagConstraintsconstraints=newGridBagConstraints();constraints.fill=GridBagConstra...
GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.EAST;
constraints.weightx = 5;
constraints.weighty = 5;
add(userLabel, constraints,0,0,1,1);
add(passLabel,constraints ,0,1,1,1);
add(twopassLabel,constraints,0,2,1,1);
add(nameLabel,constraints,0,3,1,1);
add(sexLabel,constraints , 0,4,1,1);
add(addressLabel,constraints,0,5,1,1); public void add(Component c,GridBagConstraints constraints,
int x,int y,int w,int h)
{
constraints.gridx= x;
constraints.gridy=y;
constraints.gridwidth= w;
constraints.gridheight= y;
add(c,constraints);
}gridx gridy这没冲突啊,怎么会是这种效果?重叠到一起来了 展开
constraints.anchor = GridBagConstraints.EAST;
constraints.weightx = 5;
constraints.weighty = 5;
add(userLabel, constraints,0,0,1,1);
add(passLabel,constraints ,0,1,1,1);
add(twopassLabel,constraints,0,2,1,1);
add(nameLabel,constraints,0,3,1,1);
add(sexLabel,constraints , 0,4,1,1);
add(addressLabel,constraints,0,5,1,1); public void add(Component c,GridBagConstraints constraints,
int x,int y,int w,int h)
{
constraints.gridx= x;
constraints.gridy=y;
constraints.gridwidth= w;
constraints.gridheight= y;
add(c,constraints);
}gridx gridy这没冲突啊,怎么会是这种效果?重叠到一起来了 展开
1个回答
2013-08-11
展开全部
int x,int y,int w,int h)
{
constraints.gridx= x;
constraints.gridy=y;
constraints.gridwidth= w;
constraints.gridheight= y; constraints.gridheight= h;
add(c,constraints);
}
{
constraints.gridx= x;
constraints.gridy=y;
constraints.gridwidth= w;
constraints.gridheight= y; constraints.gridheight= h;
add(c,constraints);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询