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

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 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 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.

See also  Does It Make Sense to Splurge on a Laptop?

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist