This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Help me to solve these problems in JEditorPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help me to solve these problems in JEditorPane" Watch "Help me to solve these problems in JEditorPane" New topic
Author

Help me to solve these problems in JEditorPane

arun mahajan
Ranch Hand

Joined: Dec 07, 2001
Posts: 305
Hello,
I was trying to use JEditorPane and was able to sucessfully use same except two problems:
1. When mouse comes over the link it doesnot change to "hand cursor". DoI have to use customise cursor? pl help me. if possible can you provide me code snppet.
2. now when a html page comes into the pane and if I click at a button provided in the page it gives me error.
Regards,
Arun
vicky bawge
Ranch Hand

Joined: Sep 04, 2001
Posts: 34
Hi Arun,
try this.
public void hyperlinkUpdate(HyperlinkEvent evt)
{
//Swing itself doesn't change the cursor when mouse moves over the link. so
if (evt.getEventType() == HyperlinkEvent.EventType.ENTERED) {
JEditorPane pane = (JEditorPane) evt.getSource();
// Enter event. Go the the "hand" cursor and fill in the status bar
pane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
else if (evt.getEventType() == HyperlinkEvent.EventType.EXITED) {
JEditorPane pane = (JEditorPane) evt.getSource();
// Exit event. Go back to the default cursor and clear the status bar
pane.setCursor(Cursor.getDefaultCursor());
}
else if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
{
//....
}
 
GeeCON Prague 2014
 
subject: Help me to solve these problems in JEditorPane