Hi.
I'm trying to get it, so that when someone clicks on an item in one of my columns it opens up a browser window, depending on the row that they have clicked on.
For example, in my table i may have
Name Number
Alex 1
David 2
Mike 3
When someone clicks on Alex, i want it to take them to www.site1.com, when someone clicks on David, it takes them to www.site2.com etc...
Now i've searched the forums, and read about listeners etc, however i'm not sure how to make it so that each row has a different link.
The table is current built using:
public GetFarms() throws Exception {
URL theUrl = new URL("http://www.allydm.co.uk/Covenant/farm_list.php");
BufferedReader in = new BufferedReader(
new InputStreamReader(
theUrl.openStream()));
String inputLine = in.readLine();
String[] lines = inputLine.split("<br>");
for (int i = 0; i < ROWS; i++) {
String[] stuff = lines.split(" ");
for (int j = 0; j < COLUMNS; j++) {
cells[i][j] = stuff[j];
}
}
in.close();
String[] columnNames = {"Username", "DA", "Sentry", "Last Update"};
sampleJTable = new JTable(cells, columnNames);
JScrollPane tablePane = new JScrollPane(sampleJTable);
tablePane.setPreferredSize(new Dimension(420, 295));
add(tablePane, BorderLayout.CENTER);
}
Does anyone have any suggestions on how i could implement links?
Thankyou for any help.