Ãëàâà 26. ßçûê Java
current= image2;
repaint();
return true;
/*
* This routine is called each time the mouse leaves the
* applet area. It restores the initial image and forces
* a repaint.
*/
public boolean mouseExit(Event evt, int x, int y){ curren =imagel;
repaint();'return true;
* This routine is called each time the mouse is clicked in the
* applet area. It causes the browser to jump to the specified
* URL.
*/
public boolean mouseDown(Event evt, intx,int y)( URL hrefURL= null;
try (
hrefURL= new URL(href);
getAppletContext().showDocument(hrefURL);
}catch (Exception e){
System.out.println("Couldn't go to URL");
return true;
t
/*
* The paint method is what actually displays the i'mage.
*/ public void paint(Graphics g)(
g.draw Image(current, 0, 0, this);
}