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

    Default Handling hyperlinks and standard text in a table cell


    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!


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

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


    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, 05:09 AM
  2. [SOLVED] hyperlinks in JTextPane
    By olbion in forum New To Java
    Replies: 4
    Last Post: 05-05-2008, 04:28 AM
  3. hyperlinks from menu items?
    By asterope118 in forum New To Java
    Replies: 1
    Last Post: 07-16-2007, 02: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