title: Java JTree node is a clickable URL link
body: <p>I'm trying to make a node be a clickable URL, but I just can't seem to figure out how.</p>
  
  <p>I've searched high and low, and I can't seem to find a solution.</p>
  
  <p>This is my code:</p>
  
  <pre><code>public class NyttigeLinks {
  
      private static JFrame nyttigeLinks;
  
      public static void main(String[] args) {
  
                      initialize();
              }
  
      public NyttigeLinks() {
  
      }
  
      private static void initialize() {
          nyttigeLinks = new JFrame();
          nyttigeLinks.setBounds(new Rectangle(0, 0, 350, 650));
          nyttigeLinks.getContentPane().setBounds(new Rectangle(0, 0, 350, 650));
          nyttigeLinks.getContentPane().setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
          nyttigeLinks.getContentPane().setLayout(null);
  
          JLabel logoLabel = new JLabel("");
          logoLabel.setIcon(new ImageIcon(NyttigeLinks.class.getResource("/images/ssiLogo.jpg")));
          logoLabel.setBounds(0, 0, 350, 60);
  
          JTree tree = new JTree();
  
          nyttigeLinks.getContentPane().add(logoLabel);
  
          JScrollPane scrollPane = new JScrollPane(tree);
          scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
          scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
          scrollPane.setBounds(10, 71, 324, 508);
          nyttigeLinks.getContentPane().add(scrollPane);
  
          tree.setModel(new DefaultTreeModel(
              new DefaultMutableTreeNode("Nyttige Links\t") {
                  {
                      DefaultMutableTreeNode node_1;
                      node_1 = new DefaultMutableTreeNode("Projekt Wiki");
                          node_1.add(new DefaultMutableTreeNode("AO"));
                          node_1.add(new DefaultMutableTreeNode("Attends"));
                          node_1.add(new DefaultMutableTreeNode("Carlsberg"));
                          node_1.add(new DefaultMutableTreeNode("COOP"));
                          node_1.add(new DefaultMutableTreeNode("Dafgaard"));
                          node_1.add(new DefaultMutableTreeNode("Jysk DK"));
                          node_1.add(new DefaultMutableTreeNode("Jysk SE"));
                          node_1.add(new DefaultMutableTreeNode("Kvadrat"));
                          node_1.add(new DefaultMutableTreeNode("Solar"));
                          node_1.add(new DefaultMutableTreeNode("Stockmann"));
                          node_1.add(new DefaultMutableTreeNode("Tine"));
                          node_1.add(new DefaultMutableTreeNode("Unicef"));
                          node_1.add(new DefaultMutableTreeNode("Vectura"));
                      add(node_1);
                      node_1 = new DefaultMutableTreeNode("Helpdesk Norcic");
                          node_1.add(new DefaultMutableTreeNode("Test"));
                      add(node_1);
                      node_1 = new DefaultMutableTreeNode("Test");
                          node_1.add(new DefaultMutableTreeNode("AO"));
                          node_1.add(new DefaultMutableTreeNode("Attends"));
                          node_1.add(new DefaultMutableTreeNode("Carlsberg"));
                          node_1.add(new DefaultMutableTreeNode("COOP"));
                          node_1.add(new DefaultMutableTreeNode("Dafgaard"));
                          node_1.add(new DefaultMutableTreeNode("Jysk DK"));
                          node_1.add(new DefaultMutableTreeNode("Jysk SE"));
                          node_1.add(new DefaultMutableTreeNode("Kvadrat"));
                          node_1.add(new DefaultMutableTreeNode("Solar"));
                          node_1.add(new DefaultMutableTreeNode("Stockmann"));
                          node_1.add(new DefaultMutableTreeNode("Tine"));
                          node_1.add(new DefaultMutableTreeNode("Unicef"));
                          node_1.add(new DefaultMutableTreeNode("VecturaAO"));
                          node_1.add(new DefaultMutableTreeNode("Attends"));
                          node_1.add(new DefaultMutableTreeNode("Carlsberg"));
                          node_1.add(new DefaultMutableTreeNode("COOP"));
                          node_1.add(new DefaultMutableTreeNode("Dafgaard"));
                          node_1.add(new DefaultMutableTreeNode("Jysk DK"));
                          node_1.add(new DefaultMutableTreeNode("Jysk SE"));
                          node_1.add(new DefaultMutableTreeNode("Kvadrat"));
                          node_1.add(new DefaultMutableTreeNode("Solar"));
                          node_1.add(new DefaultMutableTreeNode("Stockmann"));
                          node_1.add(new DefaultMutableTreeNode("Tine"));
                          node_1.add(new DefaultMutableTreeNode("Unicef"));
                          node_1.add(new DefaultMutableTreeNode("VecturaAO"));
                          node_1.add(new DefaultMutableTreeNode("Attends"));
                          node_1.add(new DefaultMutableTreeNode("Carlsberg"));
                          node_1.add(new DefaultMutableTreeNode("COOP"));
                          node_1.add(new DefaultMutableTreeNode("Dafgaard"));
                          node_1.add(new DefaultMutableTreeNode("Jysk DK"));
                          node_1.add(new DefaultMutableTreeNode("Jysk SE"));
                          node_1.add(new DefaultMutableTreeNode("Kvadrat"));
                          node_1.add(new DefaultMutableTreeNode("Solar"));
                          node_1.add(new DefaultMutableTreeNode("Stockmann"));
                          node_1.add(new DefaultMutableTreeNode("Tine"));
                          node_1.add(new DefaultMutableTreeNode("Unicef"));
                          node_1.add(new DefaultMutableTreeNode("Vectura"));
                      add(node_1);
                  }
              }
          ));
          tree.setBounds(10, 71, 324, 540);
          tree.setRootVisible(false);
  
          JLabel bottomLabelTop = new JLabel("                   Nyttige Links Version 1.0");
          bottomLabelTop.setBounds(0, 590, 230, 14);
          nyttigeLinks.getContentPane().add(bottomLabelTop);
  
          JLabel bottomLabelBot = new JLabel("                              Made by xxx");
          bottomLabelBot.setBounds(0, 605, 230, 15);
          nyttigeLinks.getContentPane().add(bottomLabelBot);
  
          JButton btnNewButton = new JButton("Admin");
          btnNewButton.setIcon(new ImageIcon(NyttigeLinks.class.getResource("/images/appIcon.ico")));
          btnNewButton.setBounds(240, 590, 80, 20);
          nyttigeLinks.getContentPane().add(btnNewButton);
          nyttigeLinks.setPreferredSize(new Dimension(350, 650));
          nyttigeLinks.setSize(new Dimension(350, 650));
          nyttigeLinks.setResizable(false);
          nyttigeLinks.setTitle("Nyttige Links");
          nyttigeLinks.setIconImage(Toolkit.getDefaultToolkit().getImage(NyttigeLinks.class.getResource("/images/appIcon.ico")));
          nyttigeLinks.setBackground(Color.YELLOW);
          nyttigeLinks.setBounds(100, 100, 350, 650);
          nyttigeLinks.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          nyttigeLinks.setVisible(true);
      }
  }
  </code></pre>
  
  <p>I apologize for being a bit of a noob, but you gotta start somewhere, right?</p>
  
  <p>If someone can point me in the right direction, I would appreciate it a lot! Have a good night everyone!</p>