本帖最后由 HM汪磊 于 2013-4-5 19:24 编辑
编译通过,运行时提示 错误: 仅当显式请求注释处理时才接受类名称 'Test33',请问怎么处理???
import java.awt.*;
import java.awt.event.*;
//import java.awt.Color.*;
class FrameDemo
{
private Frame f;
private Button but;
private Color c;
FrameDemo()
{
c=new Color(8);
f=new Frame("Frame");
f.setBounds(300,100,500,500);
f.setLayout(new FlowLayout());
f.setForeground(c.getColor("PINK"));
but=new Button("Click");
but.setForeground(c.getColor("GREEN"));
but.setSize(50,50);
f.add(but);
FrameAction();
ButtonAction();
f.setVisible(true);
}
private void FrameAction()
{
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
private void ButtonAction()
{
but.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.out.println("Click");
System.exit(0);
}
});
}
}
class Test33
{
public static void main(String[] args)
{
new FrameDemo();
}
}
|
|