1 36 37 40 41 import java.awt.Graphics ; 42 import java.net.URL ; 43 import java.net.MalformedURLException ; 44 45 53 class LinkArea extends ImageMapArea { 54 55 URL anchor; 56 57 60 public void handleArg(String arg) { 61 try { 62 anchor = new URL (parent.getDocumentBase(), arg); 63 } catch (MalformedURLException e) { 64 anchor = null; 65 } 66 } 67 68 72 public boolean isTerminal() { 73 return true; 74 } 75 76 79 public void enter() { 80 showStatus((anchor != null) 81 ? "Go To " + anchor.toExternalForm() 82 : null); 83 } 84 85 88 public void exit() { 89 showStatus(null); 90 } 91 92 96 public boolean lift(int x, int y) { 97 if (inside(x, y) && anchor != null) { 98 showDocument(anchor); 99 } 100 return true; 101 } 102 } 103 | Popular Tags |