Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8332225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:39:42+00:00 2026-06-09T02:39:42+00:00

My question is how can I make the hyperlinks from a JXTable column (just

  • 0

My question is how can I make the hyperlinks from a JXTable column (just for one/specific column) to action like “_blank” links of my default desktop web browser.

I use JXTable and a DefaultTableModel, also I call the data from a sqlite database. I made the research on the internet, google, […] and I found a lot of information which says, If I don’t make a mistake:

  • registering a MouseListener to JXTable;
  • generate point object from MouseEvent;
  • get the text via getValueAt

***Note: The column have just 1 link per cell, without any text, just the link.

For now I have implemented this code to make an action where a cell is double clicked. Please someone can help me to implement a column hyperlinks which opening in default browser like in this example (but I don’t know how to adapt because the data are not called from a database).

Table_Employee.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
      if (e.getClickCount() == 2) {
         JXTable target = (JXTable)e.getSource();
         int row = target.getSelectedRow();
         int column = target.getSelectedColumn();
           JFrame newFrame = new JFrame();               //I want to open an distinc link
               newFrame.setTitle("Detail Screen");       //for every cell along one column
               newFrame.setVisible(true);                //in the web browser, not a frame.
         }
   }
});

EDIT 1
The code from EDIT 2 of @Kleopatra have some issues for my application. Also, I made another try like the code bellow, and voila – the links are there when first click is involved, but don’t react (no browser open).
@Kleopatra, can you provide me more information about your suggestion, because when I’m trying to put that code, the IDE don’t recognize hyperlinkColumn.

Table_Employee.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
      if (e.getClickCount() == 1) {
         JXTable target = (JXTable)e.getSource();
         int row = target.getSelectedRow();
         int column = target.getSelectedColumn();
         AbstractHyperlinkAction<Object> simpleAction = new AbstractHyperlinkAction<Object>(null) {

                public void actionPerformed(ActionEvent e) {
                //open the browser event?
                }
         };

    TableCellRenderer renderer = new DefaultTableRenderer(
    new HyperlinkProvider(simpleAction));
        Table_Employee.getColumnExt(2).setEditable(false);
        Table_Employee.getColumnExt(2).setCellRenderer(renderer);
      }
   }
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T02:39:44+00:00Added an answer on June 9, 2026 at 2:39 am

    no listeners involved, SwingX has a HyperlinkProvider that you simply configure with an action as needed:

    JXTable table = new JXTable(myModel);
    AbstractHyperlinkAction<Object> simpleAction = new AbstractHyperlinkAction<Object>(null) {
    
        public void actionPerformed(ActionEvent e) {
            // here goes what you want to do on activating the hyperlink
            //LOG.info("hit: " + getTarget());
        }
    
    };
    TableCellRenderer renderer = new DefaultTableRenderer(
        new HyperlinkProvider(simpleAction));
    table.getColumnExt(0).setEditable(false);
    table.getColumnExt(0).setCellRenderer(renderer);
    

    Note that the column needs to be not-editable to auto-support hyperlinks.

    Edit 2

    If you want to open the browser/mail client, then use a HyerlinkProvider configured with a SwingX HyperlinkAction. This is backed by core DesktopAction. Its target must be of type URI, then it auto-detects whether to open the one or other.

    You can manually install it per-column:

    TableCellRenderer renderer = new DefaultTableRenderer(
        new HyperlinkProvider(new HyperlinkAction()));
    table.getColumnExt(0).setEditable(false);
    table.getColumnExt(0).setCellRenderer(renderer);
    

    In fact, it’s even simpler: JXTable already has it as default for URI class. All you have to do is to implement your model such that it contains uris and reports that as its column class:

    DefaultTableModel model = new DefaultTableModel(...) {
    
         @Override
         Class<?> getColumnClass(int column) {
             if (column == hyperlinkColumn) {
                 return URI.class;
             } 
             ... // handle other columns
             return super.getColumnClass(column);
         }
    
         @Override
         boolean isCellEditable(int row, int column) {
             if (column == hyperlinkColumn) {
                return false; 
             }
             ... // handle other columns
             return super.isCellEditable(row, column); 
         }
    }
    

    For seeing that support in action – it’s the same for JXList/JXTree – run the SwingLabs web demo: examples are on several pages, f.i. JXTable, Hyperlink/extended, Highlighter and skim through the code that comes with it

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just like the question how can make it look glassy? I just want one
My question is, how can i make an ajax request from a page in
Quick question, how can I make this valid : if($this->datos->bathrooms == 1½){$select1 = JText::_(
This is a silly question, but how can I make the stroke of some
Brief question What command can I use to make my DataSet refresh it's connection
My question is pretty simple: How can I write a function once and make
I am starting this question to try and make a central point developers can
Question Can I style just a part of a single character? Meaning CSS attributes
My question can be boiled down to, where does the string returned from stringstream.str().c_str()
SSRS newbie question here... I have a table where one column is varbinary(max) data.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.