JLabel which hides text after reaching certain length or number of values

Posted by Patrick Kiernan on Stack Overflow See other posts from Stack Overflow or by Patrick Kiernan
Published on 2010-03-26T11:10:06Z Indexed on 2010/03/26 11:13 UTC
Read the original article Hit count: 444

Filed under:
|
|
|

The purpose of the JLabel is to show who a message is to, like in a mail client e.g.

To: John, Mary, Peter, Frank, Tom, Harry

I will have the names in a vector so can build up a string from that and then set the label's text to this string. However it has the potential to get quite long. I was think it might be nice to have something like this:

To: John, Mary, Peter, Frank, Tom, Harry, ...

Then when you click on the '...', it will expand more or just show a tool tip if you mouse over the ... Yes this idea is stolen from Thunderbird! I am open to other ideas, don't have to use a JLabel.

Thanks.

© Stack Overflow or respective owner

Related posts about java

Related posts about swing