Browse Source

SDK:
- fix resolution change in NiftyGUI editor

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

nor..67 13 years ago
parent
commit
ea532913ba
1 changed files with 11 additions and 12 deletions
  1. 11 12
      jme3-gui/src/com/jme3/gde/gui/multiview/NiftyPreviewPanel.java

+ 11 - 12
jme3-gui/src/com/jme3/gde/gui/multiview/NiftyPreviewPanel.java

@@ -11,7 +11,6 @@ import com.jme3.gde.core.scene.SceneApplication;
 import com.jme3.gde.gui.NiftyGuiDataObject;
 import com.jme3.gde.gui.NiftyGuiDataObject;
 import com.jme3.renderer.ViewPort;
 import com.jme3.renderer.ViewPort;
 import de.lessvoid.nifty.Nifty;
 import de.lessvoid.nifty.Nifty;
-import de.lessvoid.nifty.tools.resourceloader.FileSystemLocation;
 import java.awt.Dimension;
 import java.awt.Dimension;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 import java.awt.event.ItemListener;
@@ -20,7 +19,6 @@ import java.awt.event.KeyListener;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
 import java.awt.event.MouseListener;
 import java.awt.event.MouseMotionListener;
 import java.awt.event.MouseMotionListener;
-import java.io.File;
 import java.util.Collection;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Iterator;
 import java.util.concurrent.Callable;
 import java.util.concurrent.Callable;
@@ -57,6 +55,7 @@ public class NiftyPreviewPanel extends PanelView {
     private NiftyPreviewInputHandler inputHandler;
     private NiftyPreviewInputHandler inputHandler;
     private NiftyJmeDisplay niftyDisplay;
     private NiftyJmeDisplay niftyDisplay;
     private JScrollPane scrollPanel;
     private JScrollPane scrollPanel;
+    private int width = 640, height = 480;
 
 
     public NiftyPreviewPanel(NiftyGuiDataObject niftyObject, ToolBarDesignEditor comp) {
     public NiftyPreviewPanel(NiftyGuiDataObject niftyObject, ToolBarDesignEditor comp) {
         super();
         super();
@@ -78,8 +77,6 @@ public class NiftyPreviewPanel extends PanelView {
 
 
             public void itemStateChanged(ItemEvent e) {
             public void itemStateChanged(ItemEvent e) {
                 String string = (String) e.getItem();
                 String string = (String) e.getItem();
-                final int width;
-                final int height;
                 if ("640x480".equals(string)) {
                 if ("640x480".equals(string)) {
                     width = 640;
                     width = 640;
                     height = 480;
                     height = 480;
@@ -110,7 +107,7 @@ public class NiftyPreviewPanel extends PanelView {
                         return null;
                         return null;
                     }
                     }
                 });
                 });
-                updatePreView(screen);
+//                updatePreView();
             }
             }
         });
         });
         toolBar.add(comboBox);
         toolBar.add(comboBox);
@@ -260,6 +257,7 @@ public class NiftyPreviewPanel extends PanelView {
     @Override
     @Override
     public void showSelection(Node[] nodes) {
     public void showSelection(Node[] nodes) {
         this.screen = nodes[0].getName();
         this.screen = nodes[0].getName();
+        final String screen = this.screen;
         SceneApplication.getApplication().enqueue(new Callable<Object>() {
         SceneApplication.getApplication().enqueue(new Callable<Object>() {
 
 
             public Object call() throws Exception {
             public Object call() throws Exception {
@@ -271,12 +269,13 @@ public class NiftyPreviewPanel extends PanelView {
 
 
     public void cleanup() {
     public void cleanup() {
         offPanel.stopPreview();
         offPanel.stopPreview();
-//        SceneApplication.getApplication().enqueue(new Callable<Object>() {
-//
-//            public Object call() throws Exception {
-//                nifty.exit();
-//                return null;
-//            }
-//        });
+        SceneApplication.getApplication().enqueue(new Callable<Object>() {
+
+            public Object call() throws Exception {
+                ViewPort guiViewPort = offPanel.getViewPort();
+                guiViewPort.removeProcessor(niftyDisplay);
+                return null;
+            }
+        });
     }
     }
 }
 }