Question:
My problem is that the main applet serves as a sort of navigator page. When the user clicks a certain mouse xy the applet opens a new window (frame). This new frame contains some more graphics and servers as a sub-navigation window. When the user clicks a mouse xy in the window, the applet must make a :
getAppletContext().showDocument(theURL,”_main”);
, which under normal curcumtances opens a new browser window with the URL. PThe problem is that this seams impossible because I can’t even compile the code; I get the message “Can’t make static reference to method java.net.URL getDocument.” The mouse handler is placed in the main applet and not in the window’s class. If I place it in the window’s class I get the message “method getDocumentBase() not found in MyFrame” (the name of the window class).Any suggestions?
Answer:
I hope I understand your question. My suggestion is toadd a constructor to your frame class that includes an appletparameter:
class SubNavigator extends Frame { private MyApplet master; public SubNavigator(MyApplet a, …) { master = a; // etc. } // etc.}Using this parameter you may now access the browser context andpublic members of the applet from inside the frame:
URL u = new URL(master.getDocumentBase(), “foo.html”); master.showDocument(u); // etc.