• Post Reply Bookmark Topic Watch Topic
  • New Topic

web link in option dialog

 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi:
How can I put a web link, so that the user can click on it and to to the web sit, in a JOptionDialog?
I tried to put html code, but it doesn't show in the dialog

thanks
 
Brian Pipa
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way to do it (and it's how I did this in both of my apps) is to use


and pass in a custom panel as the message. In the panel, you layout your components and message like you want them and add a button that says something like "Visit Website" or whatever. Add an ActionListener to the button so that when it is clicked it uses the BrowserLauncher class (http://browserlauncher.sf.net ) to send the user to the web site.

If you don't want a button, you could make a clickable custom component that looks like a weblink and add that instead. I have written this component and keep meaning to release it as open source (free) but there are some brief examples of it floting around on the net.

If you don't understand any of this or want to see a code example, let me know.

brian
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!