I have a GPanel object that I want to draw Rectangles into separately from the main window

edited November 2016 in Raspberry PI

void draw(){ int cnt;

background(255); fill(0); image(img, 10, 10, img.width/2, img.height/2); for (cnt = 0; cnt<MAXCNT;cnt++ ){ wires[cnt].update(); wires[cnt].display(); } // this draws in the parent frame only, not in the GPanel object for(Rectangle r:rects) showFrame(r); }

Tagged:

Answers

  • Please reformat your code.

  • It is not possible to draw on the surface of a GPanel. Have a look at the GSketchpad control

  • this application will run on a Raspberry Pi with a 7" display and will be used to interface with hardware that will measure continuity / resistance of an array of electrodes. Since the interface is touch only, I need the controls to be a reasonable size on the 7" display so opted for the main screen to show electrode status and have a popup window for touch keypad numeric entry and a GPanel for slider control, options and buttons. When not in use these windows have the method setVisible(false). I wanted to separate the controls in the GPanel using an array of rectangles from the Java class , however I can see no way to attach to the GPanel since it requires an object type GAbstractControl. I'm more of a C/C++ programmer, this is my first Processing program so any guidance would be greatly appreciated. Do I need to override the Draw class in GPanel and draw the rectangles there ?

  • You can create a new class that extends the GPanel and then override the draw method to draw the extra rectangles.

  • Thanks quark, I see you answer so many questions, your effort is really appreciated

Sign In or Register to comment.