How can I enable hyperlink for every record in the JTable
?
What I want to do is such that a user can click on the hyperlink which will then display the information they can edit/update.
Alternatively how can I enable in place editing of the table data?
Another question is i am currently using the following way to display different screen. But this is not an elegant way i understand we should use cardlayout but how exactly to go about it?
mainPanel.setVisible(false);
createBlogEntryPanel.setVisible(true);
setComponent(createBlogEntryPanel);
To address the problem with
JTable
consuming the events, you can add your ownMouseListener
(or aMouseAdapter
) to theJTable
and do your manipulation inside this listener. Here is an example of what you can achieve:(The question is way too vague to answer it concisely/completely - this answer assume the main part to be the hyperlink in JTable)
Consider using a framework that fully supports hyperlinks in collection components (table, list, tree ..) - like f.i. SwingX
For a code example in SwingX, see a recent answer
Edit
As mentioned in my comment: that's not supported in SwingX (it's cell-based).
So it's back to square one with several options
The ol' style: (mis-)use a cellEditor
Extending SwingX style: enrich the rollover interface (the incubator may have examples, but that wasn't added to core SwingX for the reason of not yet being ready :-) The basic idea is to
The second can be implemented independently of SwingX, of course: a plain ol' custom mouseListener and the mapping logic should do the trick (sorry, no code handy)