当前位置: 代码迷 >> Java相关 >> java TFActionEvent
  详细解决方案

java TFActionEvent

热度:187   发布时间:2010-04-01 10:27:11.0
java TFActionEvent
import java.awt.*;
import java.awt.event.*;
//import java.util.*;
//import java.lang.*;
//import static net.mindview.util.Print.*;

public class TFActionEvent
{
    public static void main(String[] args)
    {
        new TFFrame();
    }
}

class TFFrame extends Frame
{
    TFFrame()
    {
        TextField tf = new TextField();
        add(tf);
        tf.addActionListener(new TFActionListener());
        pack();
        setVisible(true);
    }
}

class TFActionListener implements ActionListener
{
    public void actionPerformed(ActionEvent e)
    {
        TextField tf = (TextField)e.getSourse();
        System.out.println(tf.getText());
        tf.setText("");
    }
}

编译时会出现以下结果:
符号:  方法 getSourse()
位置:  类 java.awt.enevt.ActionEvent
                Textfield tf = (TextField)e.getSourse();
搜索更多相关的解决方案: java  

----------------解决方案--------------------------------------------------------
getSource()
----------------解决方案--------------------------------------------------------
  相关解决方案