Results 1 to 3 of 3
  1. #1
    itsmegb is offline Member
    Join Date
    Feb 2009
    Posts
    2
    Rep Power
    0

    Default Handling hyperlinks and standard text in a table cell

    Hi,

    I have a Jtable with one column that displays text that sometimes include hyperlinks, for example:
    Java Code:
    This cell contains a link to www .google. com
    What i would like would for the hyperlink to be represnted as a hyperlink and be clickable to open in a browser, but the standard text to remain unchanged.

    So far i have only found examples that make the entire cell a hyperlink, which isn't quite what i want.

    If anyone could shed some light on this, it would be much appreciated. If it makes any difference, the app only has to run on a windows machine.

    Thanks in advance for any help!

    gb

  2. #2
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

  3. #3
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    mtyoung alluded to a possible solution. If you make the cell contents a JEditorPane, you can set the kit type to "text/html", which will present hyperlinks properly.

    Caveat: JEditorPane does not actually handle hyperlink clicks. You have to add handlers for that yourself. Building a fully operational browser around JEditorPane requires a *LOT* of code.

Similar Threads

  1. standard deviation and mean for an array
    By peterdfl in forum New To Java
    Replies: 3
    Last Post: 05-29-2008, 04:09 AM
  2. [SOLVED] hyperlinks in JTextPane
    By olbion in forum New To Java
    Replies: 4
    Last Post: 05-05-2008, 03:28 AM
  3. hyperlinks from menu items?
    By asterope118 in forum New To Java
    Replies: 1
    Last Post: 07-16-2007, 01:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •