构造方法不能有返回值,所以找不到构造方法了,
去掉void
public face()
public actionbutton()

解决方案 »

  1.   

    public class MyPanel {  public static class actionbutton implements ActionListener{
        private int num;
        public void actionbutton(){
          num=0;
        }
        public void actionPerformed(ActionEvent e){
          num++;
          Object o=e.getSource();
          String numstr=Integer.toString(num);
          if(o instanceof Button)
          {
             Button b=(Button) o;
             b.setLabel(numstr);
          };
        }
      }
      public static void main(String args[])
      {
        System.out.println("1111");
        face f=new face();
      }
    }
      public static class face extends JPanel{
        private JButton jButton1 = new JButton();
        private JTextField jTextField1 = new JTextField();
        public void face()
        {
          System.out.println("2222");
          jButton1.setBounds(new Rectangle(119, 22, 113, 35));
          jButton1.setText("count");
          this.setLayout(null);
          jTextField1.setText("0");
          jTextField1.setBounds(new Rectangle(96, 88, 284, 36));
          this.add(jButton1, null);
          this.add(jTextField1, null);
          System.out.println("3333");
          actionbutton ab=new actionbutton();
          jButton1.addActionListener(ab);
          System.out.println("4444");
        }
      }