import java.awt.*;
import java.awt.Event;public class HappyNewYear {
public static void main(String[] args) {
new MyFrame("");
}
}
class MyFrame extends Frame{
MyFrame(String s){
Frame f = new Frame("Best Wish To You");
f.setSize(400,300);
f.setLocation(40, 30);
f.setBackground(Color.BLACK);
f.setVisible(true);
this.addWindowListener(new WindowAdapter(){
public void WindowClosing(WindowEvent e){
setVisible(false);
System.exit(-1);
}
});
}
}
那个WindowAdapter一直说是不能解释为类型。
不知道是什么原因。
import java.awt.Event;public class HappyNewYear {
public static void main(String[] args) {
new MyFrame("");
}
}
class MyFrame extends Frame{
MyFrame(String s){
Frame f = new Frame("Best Wish To You");
f.setSize(400,300);
f.setLocation(40, 30);
f.setBackground(Color.BLACK);
f.setVisible(true);
this.addWindowListener(new WindowAdapter(){
public void WindowClosing(WindowEvent e){
setVisible(false);
System.exit(-1);
}
});
}
}
那个WindowAdapter一直说是不能解释为类型。
不知道是什么原因。
解决方案 »
- 请问关于import java.class.*的问题.......
- 用Java编写与windows中自带记事本几乎一样的代码
- sql server 2005 导出数据库的mdf文件和ldf文件到目标文件夹
- junit 怎么入门?
- applet 小程序 url构造函数那块有点问题好像 恳请大侠帮忙
- 怎样可以响应“新建”子菜单
- 打包jar文件失败?????
- java通过JNI读取注册表信息报错
- 如何用JAVA获取网卡信息?
- JBuild 3.5运行速度真慢!有何方法可以提高速度???
- 继承AbstractTableModel,自己写了一个TableModel,但是,fireTableXXXX函数用不来?
- 代码问题(急)
import java.awt.event.*;
public class HappyNewYear {
public static void main(String[] args) {
new MyFrame().launch();
}
}class MyFrame extends Frame{
public void launch(){
setTitle("best wish!!");
setSize(400,300);
setLocation(40, 30);
setBackground(Color.BLACK);
this.addWindowListener(new WindowAdapter()
{
public void WindowClosing(WindowEvent e){
System.exit(0);
}
}
);
setVisible(true);
}
}
import java.awt.event.WindowEvent;
即包你写错了。
import java.awt.event.*;
import java.awt.Color;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;public class HappyNewYear {
public static void main(String[] args) {
new MyFrame("");
}
}class MyFrame extends Frame
{
MyFrame(String s){
Frame f = new Frame("Best Wish To You");
f.setSize(400,300);
f.setLocation(40, 30);
f.setBackground(Color.BLACK);
f.setVisible(true);
this.addWindowListener(new WindowAdapter(){
public void WindowClosing(WindowEvent e){
setVisible(false);
System.exit(-1);
}
});
}
}