编了个简单的程序...但有报错,找不出原因...
import java.awt.event.WindowAdapter;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
public class MainFrame extends JFrame{
MainFrame(){
setBounds(100,100,800,550);
setTitle("网络设备管理系统");
setVisible(true);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){ //WindowEvent cannot be resolved to a type ?????? 这里出现错误.
setVisible(false);
dispose();
System.exit(0);
}
}
);
}
public static void main(String[] args) {
MainFrame window=new MainFrame();
}}
import java.awt.event.WindowAdapter;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
public class MainFrame extends JFrame{
MainFrame(){
setBounds(100,100,800,550);
setTitle("网络设备管理系统");
setVisible(true);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){ //WindowEvent cannot be resolved to a type ?????? 这里出现错误.
setVisible(false);
dispose();
System.exit(0);
}
}
);
}
public static void main(String[] args) {
MainFrame window=new MainFrame();
}}
解决方案 »
- java怎么生成距离相等的点
- 请问这段JAVA代码如何转换成C++代码?
- 集合类的一个问题~!
- jtree节点图标问题?
- 基本类型中的boolean占用多少内存?
- 200分求 Together for eclipse 6.2 的注册机
- 求问一个分割方法. -- 把特定字符之间的字符剥离出来.
- jb7中 Tools->Configure Servers 中的设置问题
- 请问Properties 的void store(OutputStream out,String header)怎么用?
- Java Map排序
- TCP与UDP的问题??
- java的一个大list如何分成多个list,比如在一个list取相同值,在相同值中再取第一个值及最后一个值
楼主【cswudafeng】截止到2008-07-01 20:30:59的历史汇总数据(不包括此帖):
发帖的总数量:26 发帖的总分数:910
结贴的总数量:20 结贴的总分数:590
无满意结贴数:2 无满意结贴分:40
未结的帖子数:6 未结的总分数:320
结贴的百分比:76.92 % 结分的百分比:64.84 %
无满意结贴率:10.00 % 无满意结分率:6.78 %
楼主加油
WindowEvent 不能被解析
把包导入就行了import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;class MainFrame extends JFrame {
MainFrame() {
setBounds(100, 100, 800, 550);
setTitle("网络设备管理系统");
setVisible(true);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
setVisible(false);
dispose();
System.exit(0);
}
});
} public static void main(String[] args) {
MainFrame window = new MainFrame();
}