我在尝试将 a 添加PApplet到 SWT 时遇到问题,当它应该只渲染PApplet. 即PApplet作品本身,但不在 SWT 窗口中。
我认为PApplet在 Eclipse 中使用 SWT 教程代码,最初只需将其添加到框架中就可以解决问题。显然这并不容易。这是我的代码,MyPApplet自定义代码在哪里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();
}
我错过了什么吗?