当前位置: 代码迷 >> Java相关 >> [求助]编写一个小程序,竖状标签
  详细解决方案

[求助]编写一个小程序,竖状标签

热度:94   发布时间:2007-04-14 21:57:07.0
[求助]编写一个小程序,竖状标签

下面这个程序那里有问题?
import java.awt.*;
import java.applet.*;
import java.awt.event.*;

class MyLabel extends Label
{ Label l1,l2,l3,l4,l5;
Panel panel;
GridBagLayout gl ;
GridBagConstraints c ;

MyLabel(Container con)
{
gl=new GridBagLayout();
c=new GridBagConstraints();
panel.setLayout(gl);
panel=new Panel();
con.add(panel);

l1=new Label(" 1");
l2=new Label(" 2");
l3=new Label(" 3");
l4=new Label(" 4");
l5=new Label(" 5");

c.gridx = 0;
c.gridy = 0;
gl.setConstraints(l1, c);
panel.add(l1);


c.gridx = 0;
c.gridy = 1;
gl.setConstraints(l2, c);
panel.add(l2);

c.gridx = 0;
c.gridy = 2;
gl.setConstraints(l3, c);
panel.add(l3);

c.gridx = 0;
c.gridy = 3;
gl.setConstraints(l4, c);
panel.add(l4);

c.gridx = 0;
c.gridy = 4;
gl.setConstraints(l5, c);
panel.add(l5);
}
}

public class Zuoye10_4 extends Applet
{
MyLabel lab;
public void init()
{
lab=new MyLabel(this);
add(lab);

}

}

搜索更多相关的解决方案: 编写  

----------------解决方案--------------------------------------------------------
  相关解决方案