Sounds simple but it isn't. First a little JTable 101. Each cell in a JTable isn't a component. It is a block on the screen that is painted. Think of it more like an image. The JTable looks up a cell renderer based on the cell location, object type in the cell, etc and then uses it to paint the area. The default cell render is based off a JLabel. Since there is no component, you can't add a mouse listener or track click events to that label.
When you click on a cell the table goes into "edit" mode. A cell editor is created and displayed in the area the cell previous occupied. This is an acutal component that you can manipulate if you want.
Now back to your case. I'm guessing you want your links to appear as html style links. Since the table uses a render that extends JLabel (
which supports html) you can feed it text like this:
<html><b><a href="">bold</a></b></html>
However, I wouldn't recommend altering the data in your model just to effect display. Instead I would create a custom cell renderer which accomplishes this effect and set it on the table. You could either wrap your text in the HTML or manually set font color and style properties on the renderer to mimic html.
Now even if you were to include the url in the html you still can't click on it. There is no component in the table. You don't really want to go into edit mode when clicking on a url. You just want to open that link. To accomplish this you would add a mouse listener to the table itself. When you receive a click event, you would then programatically determine which cell it was over, go back to your model and get the url, and finally use other
Java API calls to open that url.
A quick Google search will reveal examples of creating a cell renderer, using a mouse listener, and opening a url if you need more information.
Scott Delap
Desktop Java Live ClientJava.com