X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=src%2Fnet%2Fchiark%2Fyarrg%2FMarketUploader.java;fp=src%2Fnet%2Fchiark%2Fyarrg%2FMarketUploader.java;h=2e83678314e59cd04b66ea00bb97f70f1c2f207d;hb=48dd6e2d6b6e3ca17d01aa4d4b2a80ecbf9c24c7;hp=53b434971f92c0874fb301ada62f3aaaca8fde45;hpb=c3697ced3acabd60d04562f8a5965a3ceb4c3f22;p=jarrg-ian.git
diff --git a/src/net/chiark/yarrg/MarketUploader.java b/src/net/chiark/yarrg/MarketUploader.java
index 53b4349..2e83678 100644
--- a/src/net/chiark/yarrg/MarketUploader.java
+++ b/src/net/chiark/yarrg/MarketUploader.java
@@ -346,7 +346,10 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
// If the league tracker is there, we can skip the faff
// and ask for its tooltip, since we're on a boat
- Accessible leagueTracker = descendNodes(window,new int[] {0,1,0,0,2,1,1,1});
+ Accessible leagueTrackerContainer = descendNodes(window,new int[] {0,1,0,0,2,1});
+ Accessible leagueTrackerItself = descendByClass(leagueTrackerContainer,
+ "com.threerings.yohoho.sea.client.LeagueTracker");
+ Accessible leagueTracker = descend(leagueTrackerItself, 1);
try {
islandName = ((JLabel)leagueTracker).getToolTipText();
} catch (NullPointerException e) {
@@ -692,7 +695,29 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
if (dtxt!=null) dtxt.println("DESCEND "+childNum+" "+child.getClass().getName()+" OK");
return child;
}
-
+
+ /**
+ * Descends one level to the child which has the specified class.
+ *
+ * @param parent the node with children
+ * @param classname the name of the class, as a string
+ * @return the child or null
if the child is not found.
+ */
+ private Accessible descendByClass(Accessible parent, String classname) {
+ if (parent == null) return null;
+ AccessibleContext ac = parent.getAccessibleContext();
+ int children = ac.getAccessibleChildrenCount();
+ for (int i=0; i