1 21 22 package org.webdocwf.util.loader.wizard; 23 24 import java.util.*; 26 import java.net.*; 27 import java.io.*; 28 29 import javax.swing.*; 31 import javax.swing.event.*; 32 33 public class OctopusHelpPane extends JEditorPane { 34 35 private List history = new ArrayList(); 36 private int historyIndex; 37 38 public OctopusHelpPane() 40 { 41 setEditable( false ); 43 goToURL(getClass().getResource("HelpPages/main.html")); 44 45 } 46 47 public void goToURL( URL url ) 49 { 50 displayPage( url ); 51 52 history.add( url ); 53 historyIndex = history.size() - 1; 54 } 55 56 public URL forward() 58 { 59 historyIndex++; 60 if ( historyIndex >= history.size() ) 61 historyIndex = history.size() - 1; 62 63 URL url = ( URL ) history.get( historyIndex ); 64 displayPage( url ); 65 66 return url; 67 } 68 69 public URL back() 71 { 72 historyIndex--; 73 74 if ( historyIndex < 0 ) 76 historyIndex = 0; 77 78 URL url = ( URL ) history.get( historyIndex ); 80 displayPage( url ); 81 82 return url; 83 } 84 85 private void displayPage( URL pageURL ) 87 { 88 try { 90 setPage( pageURL ); 91 } 92 93 catch ( IOException ioException ) { 95 ioException.printStackTrace(); 96 } 97 } 98 } | Popular Tags |