注册 登录
编程论坛 新人交流区

简单java程序,为什么会出现这种错误>>??

wkf1983 发布于 2007-11-12 15:49, 417 次点击

import java.awt.*;
import java.awt.event.*;

public class Labeldemo extends Frame
{

public Labeldemo(String str)
{
super(str);
super.setBounds(0,0,400,300);
}

public static void main(String[] args)
{
/*Textdemo f=new Textdemo("带文本的窗口");
TextField t1=new TextField("这是单行文本");
TextArea t2=new TextArea("这是多行文本");
t1.setBakground(Color.pink);
t2.setColumns(25);
t2.setRows(10);
Panel p=new panel();
p.add(t1);
p.add(t2);
f.add(p);*/

Labeldemo f=new Labeldemo("带label的窗口");
Label l1=new Label("label1");
Label l2=new Label("label2");
Label l3=new Label("label3");
l1.setAlignment(0);
l3.setAlignment(3);
f.add(l1);//,Borderlayout.NORTH
f.add(l2);//,Borderlayout.CENTER
f.add(l3);//,Borderlayout.SOUTH

f.addWindowListener(new WindowAdapter(){

public void windowClosing(WindowEvent e)
{
System.exit(0);

}

});

f.show();

}

}

运行错误:
Exception in thread "main" java.long.illegalArgumentException:improper alignment

[此贴子已经被作者于2007-11-12 15:50:42编辑过]

0 回复
1