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

小应用程序中setLayout(new GridLayout(0,1));是什么意思?
import java.applet.Applet;
import java.awt.*;
import javax.swing.*;
public class AppletLabel extends Applet 
{
JLabel label1;
JLabel label2;


  public void init()
{
label1=new JLabel("See you tomorrow!");
label1.setForeground(Color.cyan);
label2=new JLabel("How are you?");
label2.setForeground(Color.blue);

setLayout(new GridLayout(0,1));//这句话什么意思?

add(label1);
add(label2);
}
}


<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>

<BODY>
<applet code="AppletLabel.class" width=200 height=200>
</applet>
</BODY>
</HTML>


------解决方案--------------------
One, but not both, of rows and cols can be zero, which means that any number of objects can be placed in a row or in a column. 

------解决方案--------------------
设置布局为表格布局,表格是0行1列,呵呵,应该是吧
------解决方案--------------------
0应该就是默认吧,也就是添加组建时从上往下顺着来