Border title cut off

I have created a titled border for a panel nested within another panel using:

panel.setBorder(BorderFactory.createTitledBorder("blahblah");

Unfortunately, the title is longer than the panel, so only part of the title is visible. Is there some way to force the panel size to match the border title, without resorting to absolute positioning? I am using layout managers and the title will be translated into different languages.

Thanks.

[466 byte] By [kjohnson1] at [2007-9-26 14:22:46]
# 1
I have the same problem. Anybody knows how to solve it?
lobov at 2007-7-2 16:02:49 > top of Java-index,Archived Forums,Swing...
# 2
You should know the font for your title, then use FontMetrics (a class) to "measure" the width of the new title. Then you can resize your panel accordingly.Cheers
kooshiness at 2007-7-2 16:02:49 > top of Java-index,Archived Forums,Swing...