From 6a145f6c81dfcbe0653eda27d042efb48daa7512 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Wed, 21 Aug 2019 21:05:56 -0400
Subject: [PATCH] Minor tuning

---
 GroupEditor.java |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index c86dd4d..0ac356b 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -936,6 +936,8 @@
         cGridBag currenttab;
         //boolean added; // patch for jar
                 
+        int totalcount = 0;
+        
         int tabcount = 0;
         int colcount = 0;
         int rowcount = 0;
@@ -964,7 +966,7 @@
             texturecount = 0;
         }
         
-        if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
+        if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
         {
             //if (!added)
             {
@@ -973,7 +975,8 @@
                 currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
             }
             
-            AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
+            AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
+            totalcount++;
             
             if (++colcount >= columns)
             {
@@ -999,6 +1002,8 @@
             container.add(resourcecontainer);
             
             Grafreed.ParseResources("textures", this);
+            
+            // 935. System.out.println("Total = " + totalcount);
         }
         
 	void SetupUI2(ObjEditor oe)
@@ -1259,7 +1264,10 @@
                 
                 CreateTexturePanel(textures);
                 
-                resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount()));
+                int tabCount = resourcecontainer.getTabCount();
+                
+                if (tabCount > 0)
+                    resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
                 
                 oe.toolboxPanel.add(textures);
                 

--
Gitblit v1.6.2