执行完Java程序,但是在命令提示符界面没有输入符

来源:百度知道 编辑:UC知道 时间:2024/06/02 05:34:23
执行有的Java程序时总会遇到这样的问题,特此发帖请教一下。

例如执行下面的程序之后,我不但关闭不了那个图形界面,在在命令提示符界面没有输入符。

是什么原因造成的,我该怎么解决?

import java.awt.*;
import java.awt.event.*;

class JavaActionEven extends Frame implements ActionListener
{
Button MyButton;
List MyList;
String sSymbol;
public JavaActionEven()
{
setSize(400,400);
setTitle("__________JavaActionEven________");
MyButton=new Button("button");
MyButton.setActionCommand("Circle");
MyList=new List();
MyList.add("rectangle");
MyList.add("line");
MyButton.addActionListener(this);
MyList.addActionListener(this);
setLayout(new BorderLayout());
add(MyButton,"North");
add(MyList,"South");
sSymbol=new String("---No Action!----");
setVisible(true);
}

public void actionPerformed(ActionEvent e)
{<

设一下关闭事件,就能关闭了
f.addWindowListener(new WindowAdapter(){ //使用内部类 用WindowAdapter这个类
public void windowClosing(WindowEvent e){ //使用windowClosing这个方法
System.exit(0);
}
});

ps:现在大家都用swing了

public static void main(String args[])
{
JavaActionEven mainFrame=new JavaActionEven();
mainFrame.addWindowListener(new WindowAdapter(){ //使用内部类 用WindowAdapter这个类
public void windowClosing(WindowEvent e){ //使用windowClosing这个方法
System.exit(0);
}
});
}
}