import java.awt.*;
import java.awt.event.*;
public class InnerClassDemo
{
public static void main(String args[])
{
InnerClassDemo icd=new InnerClassDemo();
}
private Frame f=new Frame();
*private java.awt.Button b1=new java.awt.Button("Button1");
*private Button b2=new Button("Button2");
private Button b3=new Button("Button3");
private Button b4=new Button("Button4");
private TextArea text= new TextArea();
private String fileName="";
public InnerClassDemo()
{
f.setLayout(new BorderLayout());
f.addWindowListener(new WindowClosing());
b1.addActionListener(new ButtonHandler());
}
}
看看我划星号的两个句子,第一个句子可以编译通过,第二个句子报错:can't resolve symbol constructor Button(java.lang.String);
这是为什么?
我就用了两个库,java.awt java.awt.event;
Button 不就只在java.awt 里有吗?为什么还会出现这种情况?