• Advertisement
Sign in to follow this  

[java] Back and Home Buttons - any suggestions,some one?

This topic is 4724 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In my App I have html file viewer that gives to user ability of context help about the programm The problem is: if the page have back or home link - no problem to return via this link but if page dont contents those links such as javadoc generated documentation for example or if I need return to index page then only closing frame helps this is the actual code. May be some link onclick listener posible here or some way to remember where I am what the curent page?Or may be to implement onkeylistener and respond let say on key H (home) and jump to index page? But more appreciate way is to return to previous page method! Your suggestions wellcomed and appreciated :)
public class W3D_HelpContext extends  JFrame
//implements ActionListener        // Listener
	JEditorPane html;	       
     	private static final int TFSPX=0;//window starts position
     	private static final int TFSPY=0;
     	private static final int TFDX=640;//window dimensions
     	private static final int TFDY=480; 
     	private static final String []topics=
 public W3D_HelpContext (int id)
   		try {
	    URL url = null;
	    String path = null;
	    try {
		path = "HELP/";
		else path+="index";
		url = getClass().getResource(path);
            } catch (Exception e) {
		if(W3D_C.debug){System.out.println("Failed to open " + path);}
		url = null;
            if(url != null) {
                html = new JEditorPane(url);
		JScrollPane scroller = new JScrollPane();
		JViewport vp = scroller.getViewport();
                getContentPane().add(scroller, BorderLayout.CENTER);
        } catch (MalformedURLException e) {
            if(W3D_C.debug){System.out.println("Malformed URL: " + e);}
        } catch (IOException e) {
            if(W3D_C.debug){System.out.println("IOException: " + e);}
    public HyperlinkListener createHyperLinkListener() 
	return new HyperlinkListener() {
	    public void hyperlinkUpdate(HyperlinkEvent e) {
		if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
		    if(e instanceof HTMLFrameHyperlinkEvent)
		    } else {
			try {
			    } catch (IOException ioe) 
			     if(W3D_C.debug){System.out.println("IOE: " + ioe);}

[Edited by - HellCreator on February 22, 2005 3:50:46 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement