A small problem,please!
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class Eventdemo extends Applet implements ActionListener
{
public void init()
{
Button b=new Button("Button");
b.setBackground(Color.red);
b.setForeground(Color.blue);
b.setSize(30,15);
b.addActionListener(this);
add(b);
}
public void actionPerformed(ActionEvent e)
{
System.out.println("Action occurred");
System.out.println("Button's lable is:"+e.getActionCommand());
System.exit(0);
}
}
There is two problems:
1.b.setSize(30,15)怎么没反映啊?
2.System.exit(0)是干什么用的,不是点击退出窗口吗?
Thank you!