class Capture { PApplet applet; String name, url; int x, y; PImage[] imgs; boolean hidden; Capture(PApplet applet, String name, String url) { this.applet = applet; this.name = name; this.url = url; imgs = new PImage[2]; for (int i = 0; i < 2; i++) { imgs[i] = loadImage("button" + i + ".png"); } } int getWidth() { return imgs[0].width; } int getHeight() { return imgs[0].height; } void draw() { if (!hidden) { if ((mouseX >= x) && (mouseX < (x + imgs[0].width)) && (mouseY >= y) && (mouseY < (y + imgs[0].height))) { if (mousePressed) { ImageToWeb img = new ImageToWeb(applet); img.setType(ImageToWeb.PNG); img.post(name, url + "upload.php", "capture", false, img.getBytes(g)); hidden = true; link(url + name + "/gallery/"); } else { image(imgs[1], x, y); } } else { image(imgs[0], x, y); } } } }