Index: /main/trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java	(revision 32705)
+++ /main/trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java	(revision 32706)
@@ -172,16 +172,21 @@
 	    tab_pane.setSelectedComponent(general_preferences);
 	}
-	
-	// Clean up
-	general_preferences = null;
-	connection_preferences = null;
-	frame_location = null;
-	frame_size = null;
-	cancel_button = null;
-	ok_button = null;
-	button_pane = null;
-	tab_pane = null;
-	content_pane = null;
-
+
+	// Clean up if not in GLI GUI test mode
+	// If in test mode, I need widgets like tab_pane and buttons to exist
+	if(!TestingPreparation.TEST_MODE) {
+	    general_preferences = null;
+	    connection_preferences = null;
+	    frame_location = null;
+	    frame_size = null;
+	    cancel_button = null;
+	    ok_button = null;
+	    button_pane = null;
+	    tab_pane = null;
+	    content_pane = null;
+	}
+
+	TestingPreparation.setNamesRecursively(this);
+	
 	setVisible(true);
     }
Index: /main/trunk/gli/src/org/greenstone/gatherer/gui/TestingPreparation.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/gui/TestingPreparation.java	(revision 32705)
+++ /main/trunk/gli/src/org/greenstone/gatherer/gui/TestingPreparation.java	(revision 32706)
@@ -34,9 +34,9 @@
 	root.setName(className);
 
-	setNamesRecursively("", root, "", true);
+	setNamesRecursively("", root, "", true, className);
 	//if (DEBUGGING_TEST_MODE) printComponentNames(root, "");
     }
     
-    private static void setNamesRecursively(String prefix, Component root, String tabSpace, boolean isTrueRoot) {
+    private static void setNamesRecursively(String prefix, Component root, String tabSpace, boolean isTrueRoot, String rootClassName) {
 	if(!TEST_MODE) return;	
 		
@@ -51,5 +51,5 @@
 		if(!prefix.equals("")){
 		    // TODO: set this to something more meaningful?
-		    root.setName(prefix + "." + className);		    
+		    root.setName(prefix + "." + className);
 		}
 		else {
@@ -57,5 +57,5 @@
 		}
 	    } // else swing Component name already set
-
+	    
 	    // now we can print out this element's name for debugging
 	    if (DEBUGGING_TEST_MODE) System.err.println(tabSpace + root.getName());
@@ -63,6 +63,21 @@
 	    
 	    if(root.getName() == null || root.getName().equals("")) {
-		root.setName(className);
-	    } else if(!isTrueRoot) {		
+		// if it's a non-member var GLIButton, give it a more sensible name
+		if(JButton.class.isAssignableFrom(root.getClass())) {
+		    JButton button = (JButton)root;
+		    root.setName(rootClassName + ".GLIButton." + button.getText()); // getLabel() deprecated
+		} else {
+		    root.setName(className);
+		}
+	    } else if(!isTrueRoot) {
+
+		// GLIButtons are GLI GUI package but they have no member vars so
+		// they would have been processed with their containing classes: their names
+		// are already set.
+		// But their names still have to be displayed if debugging
+		if(JButton.class.isAssignableFrom(root.getClass())) {
+		    if (DEBUGGING_TEST_MODE) System.err.println(tabSpace + root.getName());
+		}
+		
 		// then the name of this GLI GUI element (i.e. of GLI GUI package) was already set
 		// we've recursively dealt with this GLI element and its children already
@@ -96,14 +111,23 @@
 		    try {
 			Container memberComponent = (Container)memberVars[i].get(root);
-		    
+
+			//System.err.println("### Found (null?) member var: " + memberVars[i].getName());
 			if(memberComponent != null) {
-
+			    //System.err.println("@@@ Found member var: " + memberVars[i].getName());
+			    
 			    // member var is a JComponent but not of GLI package, so locally instantiated
-			    if(!memberVarClass.getPackage().getName().contains("org.greenstone.gatherer.gui")) {
+			    // or member var can be GLIButtons which are of GLI GUI package
+			    // but they contain no Component member vars we care about so
+			    // process GLIButtons with their containing classes
+			    if(JButton.class.isAssignableFrom(memberVarClass)
+			       || !memberVarClass.getPackage().getName().contains("org.greenstone.gatherer.gui"))
+				{
 				String memberprefix = prefix + "." + memberVars[i].getName(); // append member var name
 				
 				// now can call setName() on the actual member variable
 				memberComponent.setName(memberprefix);
-				setNamesRecursively(memberprefix, memberComponent, tabSpace+"  ", false);
+				rootClassName = memberprefix; // pass nearest parent GLI GUI class name as param
+				// for namespacing any local JButton members declared in memberVarClass
+				setNamesRecursively(memberprefix, memberComponent, tabSpace+"  ", false, rootClassName);
 			    }
 
@@ -116,5 +140,5 @@
 				//String memberprefix = memberVarClass.getSimpleName();
 				//memberComponent.setName(memberprefix);
-				setNamesRecursively("", memberComponent, tabSpace+"  ", false);
+				setNamesRecursively("", memberComponent, tabSpace+"  ", false, rootClassName);
 			    }
 			    			
@@ -140,5 +164,5 @@
 	    // if we haven't already set a name for any child JComponents with the above,
 	    // then the following will do so now
-	    setNamesRecursively(className, children[i], tabSpace+"  ", false);
+	    setNamesRecursively(className, children[i], tabSpace+"  ", false, rootClassName);
 	}    
 
