Java:编译时出现类错误

时间:2015-11-19 20:58:23

标签: java

这是我用Java编写的第一个脚本。编译脚本时出错。我想知道它有什么问题。

rdd = sc.parallelize(range(100000))
iterator = rdd.toLocalIterator()
type(iterator)

## generator

even = (x for x in iterator if not x % 2)

此代码应该在按住两秒后按住左键直到再次按下。

由于

1 个答案:

答案 0 :(得分:0)

此代码将被编译,但您当然应该开始阅读编译错误以解决此类问题。

package com.omt.mouse;

import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;

public class Main {
    static boolean mouseDown;
    static int num;

    public static void mousePressed(MouseEvent e) {
        if (e.getButton() == MouseEvent.BUTTON1) {
            mouseDown = true;
        }
    }


    public static void mouseReleased(MouseEvent e) {
        if (e.getButton() == MouseEvent.BUTTON1) {
            mouseDown = false;
        }
    }

    public static void main(String[] args) throws AWTException {

        Robot robot = new Robot();
        num = 0;
        while(true) {
            if(mouseDown) {
                if(num == 2000) {
                    robot.mousePress(InputEvent.BUTTON1_MASK);
                } else {
                    num++;
                }
            } else if (num == 2000) {
                num = 0;
                robot.mouseRelease(InputEvent.BUTTON1_MASK);
            }
        }

    }
}