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

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.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS