反了,某个类implements 某个接口

解决方案 »

  1.   

    实现ActionListener:
    class A extends JFrame implements ActionListener
    public void actionPerformed(ActionEvent e)
    {
         int result = Integer.parseInt(t1.getText())
    }
      

  2.   

    类 implements 接口   实现接口 定义的方法 
      

  3.   



    public class MJYS_Frame extends JFrame implements ActionListener
    {
    public static void main(String[] args) {
    MJYS_Frame F = new MJYS_Frame();
    F.setLayout(null);
    {
    Button B1 = new Button();
    B1.setBounds(0, 0, 120, 25);
    B1.addActionListener(this);//  Can not use this in a static context,怎样设置Button的监听?
    F.add(B1);
                   }
                   //  ....
    }
      

  4.   

    B1.addActionListener(F);//  这样就可以了