"アイドル"ステータスを検出するプログラムを作成しようとしていますが、私のコードでは問題は見られません。誰かが役に立つヒントで私を助けてくれますか?ここに私のコードです:ステートメントが機能しない場合、プログラムは直接 "else"ステートメントを入力します
package idlestatus;
import java.awt.MouseInfo;
public class Idlestatus {
public static void main(String[] args) throws InterruptedException {
Integer firstPointX = MouseInfo.getPointerInfo().getLocation().x;
Integer firstPointY = MouseInfo.getPointerInfo().getLocation().y;
Integer afterPointX;
Integer afterPointY;
while (true) {
Thread.sleep(10000);
afterPointX = MouseInfo.getPointerInfo().getLocation().x;
afterPointY = MouseInfo.getPointerInfo().getLocation().y;
if (firstPointX == afterPointX && firstPointY == afterPointY) {
System.out.println("Idle status");
} else {
System.out.println("(" + firstPointX + ", " + firstPointY + ")");
}
firstPointX = afterPointX;
firstPointY = afterPointY;
}
}
}
または 'int'ない' Integer'を使用しています。 –
まあええ...それは解決しました、ありがとうございました! –