I have been using the ControlP5 Library on my most recent project and think it is wonderful! One of the issues I see is that the text input is a bit odd in that the last character is highlighted to indicate the position of the cursor (caret). For me that is not that big of a deal, but there are several people who have used my applet and it really throws them for a loop. Ideally, the behavior of a textfield would be similar to any other editor / input forum. I have looked into creating a variant of the textfield class to accomplish this but without success. I'm sure that there is some 8 line solution that would allow this to happen but it is somewhat beyond my grasp. If anyone could provide some guidance or suggestions it would be very appreciated.
I want to create a PGraphics off-screen then upload it to my server. I am using the
Post To Web library. The .php file is on the server and successfully receives an image of the current sketch when I use the code on line 19 (verified via ftp), but does not upload my PGraphics type when I use the code on line 17. I really do not know what the 'g' in img.getBytes(g) is - any ideas?
In the console I receive the following message:
java.lang.IllegalArgumentException: im == null!
at javax.imageio.ImageIO.write(ImageIO.java:1457)
at javax.imageio.ImageIO.write(ImageIO.java:1565)
at org.seltar.Bytes2Web.ImageToWeb.getBytes(ImageToWeb.java:142)
at webApp.orderButton(webApp.java:790)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at controlP5.ControlBroadcaster.invokeMethod(Unknown Source)
at controlP5.ControlBroadcaster.callTarget(Unknown Source)
at controlP5.ControlBroadcaster.broadcast(Unknown Source)
at controlP5.Controller.broadcast(Unknown Source)
at controlP5.Button.setValue(Unknown Source)
at controlP5.Button.mouseReleased(Unknown Source)
at controlP5.Controller.setMousePressed(Unknown Source)
at controlP5.ControllerGroup.setMousePressed(Unknown Source)
at controlP5.ControllerGroup.setMousePressed(Unknown Source)
at controlP5.ControlWindow.mouseEvent(Unknown Source)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at processing.core.PApplet$RegisteredMethods.handle(Unknown Source)
at processing.core.PApplet.handleMouseEvent(Unknown Source)
at processing.core.PApplet.dequeueMouseEvents(Unknown Source)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
<p><b>Error:</b> File is empty!</p>
String url = "http://myDomain.com/Upload.php";
PGraphics pg = createGraphics(myX,myY,P2D);
pg.beginDraw();
pg.image(testImage,0,0,pg.width,pg.height);
pg.endDraw();
img.setType(ImageToWeb.PNG);
String subFolder = "subFolder";
String fileName = "fileName";
img.post(subFolder,url,fileName,false,img.getBytes(pg)); // this is the problem line