「java屏幕读取」java识别屏幕上的字

博主:adminadmin 2022-12-17 17:30:06 64

今天给各位分享java屏幕读取的知识,其中也会对java识别屏幕上的字进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

如何用java读取屏幕图象

大概思路就是下面这样了width=|x1-x2|,high=|y1-y2|

class ScreenCapture

{

/**

* @param args

*/

private Robot robot = null;

private Rectangle scrRect = null;

int x1,y1;

int width,high;

public ScreenCapture()

{

try

{

robot = new Robot();

}

catch (Exception ex)

{

System.out.println(ex.toString());

}

scrRect = new Rectangle(x1, y1, width, height);

}

public BufferedImage captureScreen()

{

BufferedImage bufImg = null;

try

{

bufImg = robot.createScreenCapture(scrRect);

}

catch (Exception e)

{

System.out.println(e.toString());

}

return bufImg;

}

}

Java中怎么可以在屏幕上多次读取字符

public class WhileDemo {

public static void main(String[] args) {

System.out.println("输入任意字符:");

Scanner scannner = new Scanner(System.in);

String input = scannner.nextLine();

while (true) {

if (input.equals("exit")) {

System.out.println("输入完毕!");

break;

}

System.out.println("你输入的内容为:" + input);

System.out.println("继续输入:");

input = scannner.nextLine();

}

}

}

如何用java获取屏幕输入整数

使用scanner获取屏幕输入

1、定义scanner,能够监听屏幕输入

Scanner sc = new Scanner(System.in);

2、通过nextInt获取输入整数

 int i = sc.nextInt();

补充:

new Scanner(System.in)创建一个Scanner,控制台会一直等待输入,输入信息后,通过nextInt获取输入的整数值

关于java屏幕读取和java识别屏幕上的字的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

The End

发布于:2022-12-17,除非注明,否则均为首码项目网原创文章,转载请注明出处。