Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Client Scripting
Expertise: Beginner
Apr 8, 1997



Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js

How do I jump to a URL from a window (frame)?

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?

I hope I understand your question. My suggestion is to add a constructor to your frame class that includes an applet parameter:

 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 and public members of the applet from inside the frame:
 URL u = new URL(master.getDocumentBase(), "foo.html");
   // etc.
DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date