Browse Source

fixed more bugs with split-view

I. Dix 7 years ago
parent
commit
2d1a04fd09
1 changed files with 11 additions and 9 deletions
  1. 11 9
      src/ui/view/GUI.java

+ 11 - 9
src/ui/view/GUI.java

@@ -2040,16 +2040,18 @@ public class GUI<E> implements CategoryListener {
                 tabbedPaneInnerOriginal.setSelectedComponent(tabbedPaneInnerOriginal.getComponentAt(i));
             }
 
-            if (tabbedPaneSplit.getComponentCount() > 0) {
+            if (tabbedPaneSplit.getTabCount() > 0) {
                 JTabbedPane tabbedPaneInnerSplit = (JTabbedPane) tabbedPaneSplit.getComponentAt(0);
-                JScrollPane paneSplit = (JScrollPane) tabbedPaneInnerSplit.getComponentAt(i);
-                if (!initSplit && paneSplit != null
-                        && ((UpperNodeCanvas) paneSplit.getViewport().getComponent(0)).upperNode.getId() == temp.getId()) {
-                    dupl = true;
-                    // set selected component to view
-                    tabbedPaneSplit.setSelectedComponent(tabbedPaneInnerSplit);
-                    // set selected tab in view to found upper-node-canvas
-                    tabbedPaneInnerSplit.setSelectedComponent(tabbedPaneInnerSplit.getComponentAt(i));
+                if (tabbedPaneInnerSplit != null) {
+                    JScrollPane paneSplit = (JScrollPane) tabbedPaneInnerSplit.getComponentAt(i);
+                    if (!initSplit && paneSplit != null
+                            && ((UpperNodeCanvas) paneSplit.getViewport().getComponent(0)).upperNode.getId() == temp.getId()) {
+                        dupl = true;
+                        // set selected component to view
+                        tabbedPaneSplit.setSelectedComponent(tabbedPaneInnerSplit);
+                        // set selected tab in view to found upper-node-canvas
+                        tabbedPaneInnerSplit.setSelectedComponent(tabbedPaneInnerSplit.getComponentAt(i));
+                    }
                 }
             }