You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Linbin Yu (JIRA)" <ji...@apache.org> on 2007/08/29 04:35:30 UTC
[jira] Updated: (HARMONY-4690) Anchor tag of HTML works incorrectly
in Harmony
[ https://issues.apache.org/jira/browse/HARMONY-4690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Linbin Yu updated HARMONY-4690:
-------------------------------
Attachment: RI.PNG
RI
> Anchor tag of HTML works incorrectly in Harmony
> -----------------------------------------------
>
> Key: HARMONY-4690
> URL: https://issues.apache.org/jira/browse/HARMONY-4690
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Environment: Win32
> Reporter: Linbin Yu
> Priority: Minor
> Attachments: Harmony.PNG, RI.PNG
>
>
> The following test demonstrates the problem:
> import java.awt.Container;
> import javax.swing.JEditorPane;
> import javax.swing.JFrame;
> import javax.swing.JScrollPane;
> import javax.swing.event.HyperlinkEvent;
> import javax.swing.event.HyperlinkListener;
> import javax.swing.text.html.HTMLDocument;
> import javax.swing.text.html.HTMLFrameHyperlinkEvent;
> public class AnchorDemo extends JFrame implements HyperlinkListener {
> public static void main(String argv[]) {
> new AnchorDemo();
> }
> public AnchorDemo() {
> JEditorPane editorPane = new JEditorPane("text/html",
> "<a name=\"a1\">top</a><br><br><br><br><br><br>"
> + "<a href=\"#a2\">link to bottom</a><br><br><br><br>"
> + "<a name=\"a2\">bottom</a><br><br><br><br><br>");
> editorPane.setEditable(false);
> editorPane.addHyperlinkListener(this);
> Container container = getContentPane();
> container.add(new JScrollPane(editorPane));
> setSize(150, 150);
> setVisible(true);
> }
> public void hyperlinkUpdate(HyperlinkEvent e) {
> if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
> JEditorPane pane = (JEditorPane) e.getSource();
> HTMLDocument doc = (HTMLDocument) pane.getDocument();
> if (e instanceof HTMLFrameHyperlinkEvent) {
> HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
> doc.processHTMLFrameHyperlinkEvent(evt);
> } else {
> try {
> pane.scrollToReference("a2");
> } catch (Throwable t) {
> t.printStackTrace();
> }
> }
> }
> }
> }
> The attached screenshots demonstrate the behavior of Harmony and RI after clicking the hyperlink "link to bottom".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.