Forráskód Böngészése

- commit ideal version of window handling (not working atm)
- Application calls createCanvas() and startCanvas(true)
- SceneViewer window calls panel.add(getCanvas())

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7085 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

nor..67 14 éve
szülő
commit
8710db14f1

+ 14 - 0
jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java

@@ -126,9 +126,20 @@ public class SceneApplication extends Application implements LookupProvider, Loo
             nodeSelectionResult.addLookupListener(this);
 
             createCanvas();
+            startCanvas(true);
             getContext().setAutoFlushFrames(true);
             getContext().setSystemListener(this);
             progressHandle.progress("initialize Base Application", 1);
+//            if (!java.awt.EventQueue.isDispatchThread()) {
+//                java.awt.EventQueue.invokeAndWait(new Runnable() {
+//
+//                    public void run() {
+//                        SceneViewerTopComponent.findInstance();
+//                    }
+//                });
+//            } else {
+//                SceneViewerTopComponent.findInstance();
+//            }
         } catch (Exception e) {
             getProgressHandle().finish();
             SceneViewerTopComponent.showOpenGLError(e.toString());
@@ -488,6 +499,9 @@ public class SceneApplication extends Application implements LookupProvider, Loo
     @Override
     public void handleError(String msg, Throwable t) {
         progressHandle.finish();
+        if (msg == null) {
+            return;
+        }
         if (!started) {
             SceneViewerTopComponent.showOpenGLError(msg);
             Exceptions.printStackTrace(t);

+ 7 - 4
jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java

@@ -58,10 +58,10 @@ public final class SceneViewerTopComponent extends TopComponent {
     /** path to the icon used by the component and its open action */
     static final String ICON_PATH = "com/jme3/gde/core/sceneviewer/jme-logo.png";
     private static final String PREFERRED_ID = "SceneViewerTopComponent";
-    private JmeCanvasContext ctx;
+//    private JmeCanvasContext ctx;
     private SceneApplication app;
-    private Lookup lookup;
-    private final InstanceContent lookupContents = new InstanceContent();
+//    private Lookup lookup;
+//    private final InstanceContent lookupContents = new InstanceContent();
     private HelpCtx helpContext = new HelpCtx("com.jme3.gde.core.sceneviewer");
 
     public SceneViewerTopComponent() {
@@ -75,6 +75,8 @@ public final class SceneViewerTopComponent extends TopComponent {
 //        putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
         try {
             app = SceneApplication.getApplication();
+//            app.createCanvas();
+//            app.startCanvas(true);
             oGLPanel.add(((JmeCanvasContext) app.getContext()).getCanvas());
         } catch (Exception e) {
             showOpenGLError(e.toString());
@@ -233,7 +235,8 @@ public final class SceneViewerTopComponent extends TopComponent {
     public void componentOpened() {
         super.componentOpened();
         try {
-            oGLPanel.add(((JmeCanvasContext) app.getContext()).getCanvas());
+//            app.startCanvas(true);
+//            oGLPanel.add(((JmeCanvasContext) app.getContext()).getCanvas());
         } catch (Exception e) {
             showOpenGLError(e.toString());
         } catch (Error err) {