1 33 34 package edu.rice.cs.drjava.ui; 35 36 import edu.rice.cs.drjava.platform.PlatformFactory; 37 38 import javax.swing.event.HyperlinkListener ; 39 import javax.swing.event.HyperlinkEvent ; 40 import java.net.URL ; 41 import java.net.MalformedURLException ; 42 43 46 public class QuickStartFrame extends HelpFrame { 47 private static final String HELP_PATH = "/edu/rice/cs/drjava/docs/quickstart/"; 48 protected static final URL INTRO_URL = 49 HTMLFrame.class.getResource(HELP_PATH + HOME_PAGE); 50 51 52 public QuickStartFrame() { 53 super("QuickStart Guide to DrJava", INTRO_URL, 54 QuickStartFrame.class.getResource(HELP_PATH + CONTENTS_PAGE), 55 ICON); 56 addHyperlinkListener(_linkListener); 57 } 58 59 63 private HyperlinkListener _linkListener = new HyperlinkListener () { 64 public void hyperlinkUpdate(HyperlinkEvent event) { 65 if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { 66 URL url = event.getURL(); 68 String protocol = url.getProtocol(); 69 70 if ((!"file".equals(protocol)) && (!"jar".equals(protocol))) { 71 PlatformFactory.ONLY.openURL(url); 75 return; 76 } 77 78 String path = url.getPath(); 80 81 if (path.indexOf(HELP_PATH+CONTENTS_PAGE) >= 0) { 82 try { 83 url = new URL (url,HOME_PAGE); } 85 catch(MalformedURLException murle) { 86 } 87 } 88 else if (path.indexOf(HELP_PATH) < 0) { 89 return; 91 } 92 if (url.sameFile(_history.contents)) { 93 return; } 95 jumpTo(url); 96 } 97 } 98 }; 99 100 101 } 102 | Popular Tags |