فهرست منبع

- SDK: attach awt panel on OGL thread

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8559 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
nor..67 14 سال پیش
والد
کامیت
dea9d0c2b1
1فایلهای تغییر یافته به همراه12 افزوده شده و 2 حذف شده
  1. 12 2
      jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java

+ 12 - 2
jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java

@@ -161,17 +161,27 @@ public class SceneApplication extends Application implements LookupProvider, Loo
 
     public Component getMainPanel() {
         if (useCanvas) {
-            return ((JmeCanvasContext)getContext()).getCanvas();
+            return ((JmeCanvasContext) getContext()).getCanvas();
         } else {
             if (panel == null) {
                 panel = ((AwtPanelsContext) getContext()).createPanel(PaintMode.Accelerated);
-                panel.attachTo(true, viewPort, overlayView, guiViewPort);
                 ((AwtPanelsContext) getContext()).setInputSource(panel);
+                attachPanel();
             }
             return panel;
         }
     }
 
+    private void attachPanel() {
+        enqueue(new Callable() {
+
+            public Object call() throws Exception {
+                panel.attachTo(true, viewPort, overlayView, guiViewPort);
+                return null;
+            }
+        });
+    }
+
     public ViewPort getOverlayView() {
         return overlayView;
     }