Is it possible to add a web link to a JDialog

Hello, Is it possible to add a web link to a JDialog that will automatically open a web browser and take the user to that page?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mick BarryJava DeveloperCommented:
you could use a JEditoPane, and add that to your dialog
Mick BarryJava DeveloperCommented:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hi cmaypop,

You can invent something like this:

import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import java.text.*;

public class LinkableDialog extends JDialog implements Runnable, ActionListener {
  JLabel jl = new JLabel("");
  public void init() {
    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent we) {
    jl.addMouseListener(new MouseAdapter() {
      public void mouseClicked(MouseEvent e) {
        try {
          Runtime.getRuntime().exec("explorer http://"+jl.getText());
        } catch(IOException ioe) {
  public void actionPerformed(ActionEvent ae) {
  public void run() {
  public void center(Component c) {
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    setLocation((dim.width - c.getWidth()) / 2, (dim.height - c.getHeight()) / 2);
  public static void main(String[] args) {
    SwingUtilities.invokeLater(new LinkableDialog());

but this works only on windows with explorer installed
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.