-1

I am making a simple web browser in Scala 2.9. This is only using HTML (no CSS, JavaScript, etc.). I used EditorPane to show the website.

Can anyone tell me how to detect a hyperlink on that page and when a user clicks on any hyperlink and redirects to that page. I am also trying to use Java HyperlinkListener to do this but I am unable to add Hyperlinklistener to EditorPane.

fragilewindows
  • 1,394
  • 1
  • 15
  • 26
Mr Atwal
  • 1
  • 1
  • I'm not sure if you are saying that you are building a simple web browser. In that case you are reading/parsing HTML and building the view, right? If that's the case it depends on what components you are using. In case I didn't get it properly: you are using an already existent web-browsing component. In that case you should tell us what you're using... – helios Feb 09 '12 at 13:57
  • http://www.scala-lang.org/api/current/index.html#scala.swing.EditorPane Yes i am doing same and using EditorPane to View. – Mr Atwal Feb 09 '12 at 14:11
  • So... you are showing the "page" into the EditorPane. In order to know when a user clicks on a "link" you'll have to know when a user clicks on what you've used to show a link, right? (click on some part of the EditorPane text) – helios Feb 09 '12 at 14:54
  • Use `.peer` to get the underlying `JEditorPane` and then do it as you would do in Java. I don't know if you can solve your problem using only the Scala abstraction of swing, which is not complete. – ziggystar Feb 09 '12 at 16:46

1 Answers1

0

I solved it.I used java JEditor pane and wrap this Jcomponent in scala swing component. To get hyper link i add hyperlinklistener to jeditorpane.

Mr Atwal
  • 1
  • 1