EventQueue.invokeLater(this);
}
+ /*
+ * We arrange to wait for the GUI to be initialised, then look at every top-level window,
+ * and if it
+ */
public void run() {
if (dtxt!=null) dtxt.println("MarketUploader run()...");
if (EventQueueMonitor.isGUIInitialized()) {
+ if (dtxt!=null) dtxt.println("MarketUploader GUI already ready");
guiInitialized();
} else {
+ if (dtxt!=null) dtxt.println("MarketUploader waiting for GUI");
EventQueueMonitor.addGUIInitializedListener(this);
}
}
public void guiInitialized() {
Window ws[]= EventQueueMonitor.getTopLevelWindows();
EventQueueMonitor.addTopLevelWindowListener(this);
- for (int i=0; i<ws.length; i++)
+ for (int i=0; i<ws.length; i++) {
+ if (dtxt!=null) dtxt.println("MarketUploader existing toplevel "+i);
topLevelWindowCreated(ws[i]);
+ }
}
- public void topLevelWindowDestroyed(Window w) {}
+ public void topLevelWindowDestroyed(Window w) {
+ if (dtxt!=null) dtxt.println("MarketUploader destroyed toplevel");
+ }
public void topLevelWindowCreated(Window w) {
if (frame!=null)
// already got it
return;
- if (!w.getAccessibleContext().getAccessibleName().equals("Puzzle Pirates"))
+ String name = w.getAccessibleContext().getAccessibleName();
+ if (dtxt!=null) dtxt.println("MarketUploader new toplevel "+name);
+ if (!name.equals("Puzzle Pirates"))
return;
- // found it
+ if (dtxt!=null) dtxt.println("MarketUploader found toplevel, creating gui");
window = w;
createGUI();
frame.setVisible(true);