import java.awt.*;
import java.awt.event.*;
class ChoiceTest extends Frame implements WindowListener {
Choice names = new Choice( );
//通过 add() 方法可以添加项目
ChoiceTest(String title) {
super(title);
names.add( "尤" );
names.add( "吴" );
names.add( "陈" );
names.add( "马" );
names.add( "耿" );
add( names );
addWindowListener(this);
}
public static void main(String args[] ){
ChoiceTest y = new ChoiceTest( "姓名选择框" );
y.setLayout(new FlowLayout());
y.setSize(400,250);
y.show();
}
public void windowClosing(WindowEvent e) { System.exit(-1); }
public void windowIconified(WindowEvent e) {}
public void windowDeiconified(WindowEvent e) {}
public void windowClosed(WindowEvent e) {}
public void windowOpened(WindowEvent e) {}
public void windowActivated(WindowEvent e) {}
public void windowDeactivated(WindowEvent e) {}
}
我感觉我这个关闭加的太麻烦了,单为了它实现一个接口...
请问有没有简单点的方法...
[此贴子已经被作者于2006-8-2 17:27:22编辑过]