Package net.sf.jiga.xtended.ui

Source Code of net.sf.jiga.xtended.ui.HyperlinkAdapter

/*

* HyperlinkAdapter.java

*

* Created on 15 novembre 2007, 03:25

*

* To change this template, choose Tools | Template Manager

* and open the template in the editor.

*/



package net.sf.jiga.xtended.ui;



import javax.swing.JEditorPane;

import javax.swing.event.HyperlinkEvent;

import javax.swing.event.HyperlinkListener;

import javax.swing.text.html.HTMLDocument;

import javax.swing.text.html.HTMLFrameHyperlinkEvent;



/**

* An HyperlinkAdpater to navigate through the Readme files and other about boxes.

* @author www.b23prodtm.info

*/

public class HyperlinkAdapter implements HyperlinkListener{

   

    /** Creates a new instance*/

    public HyperlinkAdapter() {

    }

   

    /** makes the hyperlink to actually flip the web-page

     @param e the HyperlinkEvent sent by the browser when the user clicked */

    public void hyperlinkUpdate(HyperlinkEvent e) {

        if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {

            JEditorPane pane = (JEditorPane) e.getSource();

            if (e instanceof HTMLFrameHyperlinkEvent) {

                HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;

                HTMLDocument doc = (HTMLDocument) pane.getDocument();

                doc.processHTMLFrameHyperlinkEvent(evt);

            } else {

                try {                   
                pane.setPage(e.getURL());

                } catch (Throwable t) {

                    t.printStackTrace();

                }

            }

        }

    }

   

}
TOP

Related Classes of net.sf.jiga.xtended.ui.HyperlinkAdapter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.