In learning to write Java, I like to modify the .java file, recompile,
hit the Webrunner File/Reload button and then rerun the Applet.
For the applet below, this usually gives me the following exception:
java.lang.NullPointerException
at QueryItem.mouseUp(QueryItem.java:42)
at webrunner.AppletDisplayItem.trackStop(AppletDisplayItem.java:438)
at awt.DisplayItemWindow.mouseUp(DisplayItemWindow.java:396)
at awt.Window.handleMouseUp(Window.java:185)
at awt.WServer.run(WServer.java:65)
this happens even if I don't make a change. E.g. if I hit the reload button
and then click on the Applet.
/**
* A simple applet class which creates a menu and does an action
*
* @version 1, Tue Mar 14 16:18:16 PST 1995
*/
public
class QueryItem extends Applet {
OptionMenu menu;
String label;
Container container;
/**
* Initialize the applet.
*/
public void init() {
resize(100, 100);
label = getAttribute("label");
}
public void paint(Graphics g) {
container = g.drawSurface;
g.drawString(label, width - font.stringWidth(label) - 3, height);
}
/**
* The user clicked in the applet. Start the clock!
*/
public void mouseUp(int x, int y) {
menu.unMap();
}
public void mouseDown(int x, int y) {
try {
if (menu == null)
menu = new OptionMenu(container, "A menu label", "a menu pname");
menu.move(x, y);
menu.map();
} catch(Object e) {
}
}
}
hit the Webrunner File/Reload button and then rerun the Applet.
For the applet below, this usually gives me the following exception:
java.lang.NullPointerException
at QueryItem.mouseUp(QueryItem.java:42)
at webrunner.AppletDisplayItem.trackStop(AppletDisplayItem.java:438)
at awt.DisplayItemWindow.mouseUp(DisplayItemWindow.java:396)
at awt.Window.handleMouseUp(Window.java:185)
at awt.WServer.run(WServer.java:65)
this happens even if I don't make a change. E.g. if I hit the reload button
and then click on the Applet.
/**
* A simple applet class which creates a menu and does an action
*
* @version 1, Tue Mar 14 16:18:16 PST 1995
*/
public
class QueryItem extends Applet {
OptionMenu menu;
String label;
Container container;
/**
* Initialize the applet.
*/
public void init() {
resize(100, 100);
label = getAttribute("label");
}
public void paint(Graphics g) {
container = g.drawSurface;
g.drawString(label, width - font.stringWidth(label) - 3, height);
}
/**
* The user clicked in the applet. Start the clock!
*/
public void mouseUp(int x, int y) {
menu.unMap();
}
public void mouseDown(int x, int y) {
try {
if (menu == null)
menu = new OptionMenu(container, "A menu label", "a menu pname");
menu.move(x, y);
menu.map();
} catch(Object e) {
}
}
}