I have a problem when trying to add a PApplet
into SWT, it turns up an empty window when it should just render the PApplet
. I.e. the PApplet
works by itself, but not in a SWT window.
I thought that just adding the PApplet
into the frame should initially do the trick, using the SWT tutorial code in Eclipse. Apparently it wasn't so easy. Here's my code, where MyPApplet
is a customized PApplet
:
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
Composite composite = new Composite(shell, SWT.EMBEDDED | SWT.NO_BACKGROUND);
Frame frame = SWT_AWT.new_Frame(composite);
PApplet pApplet = new MyPApplet();
frame.add(pApplet);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
Am I missing something?