I want this code to scrape a specific region on my screen (based on coordinates) and then hash it based on the hash function. And print the hashoutcome to my screen but somehow nothing shows up on my screen, any thoughts on what I did wrong? I called the region that I wanted to scrape "region"
scrape.rar
I compiled the code with Netbeans and it created a *.jar file that I attached.
package scrape; /** * * @author Jim */ import java.awt.Robot; public class Scrape { public static void main(String[] args) { // TODO code application logic here } protected int x; protected int y; private int region; private final int xofs = 3; private final int yofs = 3; public Scrape(int x, int y) { this.x = x; this.y = y; } public int hash(Robot myRobot, int x, int y, int width, int height) { int sum = 0; sum = width*height; for (int i = 0; i < width; ++i) for (int j = 0; j < height; ++j) sum = (sum << 5 ^ sum >> 27) ^ (myRobot.getPixelColor(xofs + x + i + this.x, yofs + y + j + this.y).getRGB() & 0x00ffffff); return sum; } public int doScrape(Robot myRobot) { int sum = 0; region = hash(myRobot, 157, 133, 8, 14); System.out.println("Region 1 : "+region+" : "+getData(region)+"\r\n"); sum += (int) region; return sum; } private static String getData(int rgbSum) { //compiled code throw new RuntimeException("Compiled Code"); } public String region(Robot myRobot) { return getData(region); } }