Geertjan's Blog

  • June 27, 2006

Hyperlinking and External Browsers

Geertjan Wielenga
Product Manager
Using the principles discussed in yesterday's blog entry, you can quite easily extend the application built in the Asynchronous JAX-WS Web Service Client End-to-End Scenario tutorial. At the end of it, all your returned WSDL URL's could be hyperlinks, as shown here:

To turn the tutorial application into the above, you'd need to change the JTextArea into a JEditorPane, so that you can assign the HTML Editor Kit to it, as discussed yesterday. Then you'd add a hyperlink listener, also shown yesterday, but this one would open URL's in the IDE's default external browser, using the highlighted code below:

taResults.setEditorKit(new HTMLEditorKit());
taResults.addHyperlinkListener(new HyperlinkListener(){
public void hyperlinkUpdate(HyperlinkEvent ev){
if (ev.getEventType()==HyperlinkEvent.EventType.ACTIVATED)URLDisplayer.getDefault().showURL(ev.getURL());
}catch (Exception ex){

Finally, you'd need to parse the returned WSDL URL's, because they're not returned as hyperlinks, so you'd have to turn them into hyperlinks. Then, because the WSDL URL's are returned in an HTML Editor (thanks to the HTML Editor Kit assigned in the code above), the hyperlinks are recognized as such so that you can click on them. When you do so, the IDE's default external browser opens, so that you can see the page referenced by the URL.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.