-1

SCHEDULEの下線が常に機能しない理由がわかりません(クラスに分けてみましたが、同じことですが、問題がどこにあるのかわかりません。@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

 import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;


    public class assertion extends JFrame {

     JTextField curTime, xT, yT;
     Timer timer;

     public static void main(String[] args){ 

      new assertion();

     }


     public assertion() {

      JFrame window = new JFrame("ВИ Кликер");
      window.setSize(400,400);

      JPanel mainframe=new JPanel();
            window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);




            JLabel x=new JLabel();
            x.setText("X-Coordinate");
            mainframe.add(x);

            xT=new JTextField(10);
            mainframe.add(xT);
            window.getContentPane().add(mainframe);
            window.pack();
            window.setVisible(true);



            JLabel y=new JLabel();
            y.setText("Y-Coordinate");
            mainframe.add(y);

            yT=new JTextField(10);
            mainframe.add(yT);
            window.getContentPane().add(mainframe);
            window.pack();
            window.setVisible(true);



            JLabel time=new JLabel();
            time.setText("Time");
            mainframe.add(o);

            curTime = new JTextField(10);
            mainframe.add(curTime);
            window.getContentPane().add(mainframe);
            window.pack();
            window.setVisible(true);




            JButton gO =new JButton();
            gO.setText("GO");
            mainframe.add(gO);


            gO.addActionListener(new ActionListener(){
             public  void actionPerformed(ActionEvent e){
         timer();
             }
          });


     }


     public void timer(){


      Calendar calendar = Calendar.getInstance();
      calendar.set(Calendar.HOUR_OF_DAY, 23);
      calendar.set(Calendar.MINUTE, 1);
      calendar.set(Calendar.SECOND, 0);
      Date time = calendar.getTime();

      timer = new Timer();
      timer.schedule(new assertion(), time);

     }

     public void mouse() throws AWTException {

      String xx = xT.getText(), yy = yT.getText();
      int xxx = Integer.parseInt(xx), yyy = Integer.parseInt(yy);


      Robot robot = new Robot();
      robot.mouseMove(xxx, yyy);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
     }


    }
4

2 に答える 2

1

アサーションは、必要な TimerTask を拡張しません。

他の質問スレッドで示したような匿名クラスを作成します。

于 2013-08-13T23:31:20.427 に答える