[2778] in java-interest

home help back first fref pref prev next nref lref last post

showDocument()

daemon@ATHENA.MIT.EDU (Stephen Harris)
Fri Oct 13 06:21:23 1995

From: sweh@mpn.com (Stephen Harris)
To: java-interest@java.sun.com
Date: Fri, 13 Oct 1995 09:05:37 +0100 (BST)

Hi all,
  I need to jump to another URL when the user clicks on an active
  area - similar to the ImageMap.

  Under Alpha-3 this was a call to showDocument().  Am I right in
  thinking this has become getAppletContext().showDocument() in
  the Beta API?  Do I have to perform any special cleanup before
  calling this?

  Under Netscape 2.0b1J (Solaris) this call will work once and
  once only - going back to the page or reloading or even
  running another applet totally with this call in it will
  go "bang!" and produce:
  
    Exception in thread "AWT-Motif" java.lang.NullPointerException
    at netscape.applet.MozillaAppletContext.showDocument(MozillaAppletContext.java:148)
    at (reference to my program line calling showDocument())
  
  Is this a Netscape problem, or my problem or???

  Here is minimal code to show the problem - click on
  the green button, then go back and try again :-(

import java.applet.*;
import java.awt.*;
import java.net.*;
 
public class x extends java.applet.Applet
{
  String u="http://www.mpn.com";
  URL url;
 
  public void init()
  {
    url=new URL(u);
    resize(100,100);
  }
 
  public void paint(Graphics g)
  {
    g.setColor(Color.green);
    g.fillRect(0,0,100,100);
  }
 
  public boolean mouseDown(java.awt.Event evt, int x,int y)
  {     
    getAppletContext().showDocument(url);
    return true;
  }
}
  
rgds
Stephen
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post