Source Code : Change mouse cursor during mouse-over action on hyperlinks
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Change mouse cursor during mouse-over action on hyperlinks
import java.io.FileNotFoundException;
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;
public class Main implements HyperlinkListener {
private JEditorPane pane;
public Main(JEditorPane jep) {
pane = jep;
}
public void hyperlinkUpdate(HyperlinkEvent he) {
HyperlinkEvent.EventType type = he.getEventType();
if (type == HyperlinkEvent.EventType.ENTERED) {
System.out.println(he.getURL().toString());
} else if (type == HyperlinkEvent.EventType.EXITED) {
System.out.println("Exited");
} else if (type == HyperlinkEvent.EventType.ACTIVATED) {
if (he instanceof HTMLFrameHyperlinkEvent) {
HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) he;
HTMLDocument doc = (HTMLDocument) pane.getDocument();
doc.processHTMLFrameHyperlinkEvent(evt);
} else {
try {
pane.setPage(he.getURL());
System.out.println(he.getURL().toString());
} catch (FileNotFoundException fnfe) {
pane.setText("Could not open file: <tt>" + he.getURL() + "</tt>.<hr>");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
Thank with us