StyledLabel to simulate hyperlinks

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

StyledLabel to simulate hyperlinks

Postby syntevo_tom » Fri Jan 29, 2010 10:53 am

Currently, we are using JLabel with HTML text as table cell renderer to create hyperlinks. Unfortunately, this is quite buggy (under certain conditions the one line of text is rendered in multiple lines making it unreadable in a fixed-row-size table).

Using a blue color and underlining is simple to achieve with a StyledLabel, but how to detect the style at a certain location (x-position) to change the cursor when the user hovers with the mouse over such a simulated link?

Thanks in advance.

Tom
syntevo_tom
 
Posts: 5
Joined: Thu Aug 13, 2009 1:54 am

Re: StyledLabel to simulate hyperlinks

Postby JIDE Support » Fri Jan 29, 2010 2:00 pm

I'm afraid there is no easy way for you to get the X-position in a StyledLabel. It's hidden in a painting method. To solve the issue, is it possible for you to renderer the cell with a JPanel containing several pieces of JLabels so you will be able to know which JLabel represents the simulated link. In that way, you could easily add mouse motion listener over that specific JLabel.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: StyledLabel to simulate hyperlinks

Postby syntevo_tom » Sat Jan 30, 2010 9:18 am

Thanks for the answer, although I must admit that I had the hope to get a different one. ;)
syntevo_tom
 
Posts: 5
Joined: Thu Aug 13, 2009 1:54 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 61 guests