Skip to main content

Render TitledBorder in Synth

1 reply [Last post]
curtisjackson
Offline
Joined: 2008-04-21

Hello Folks,

is there any way to draw the lined border correctly around the text of the titledBorder in Synth. Every time I set a TitledBorder through the BorderFactory, I have the problem that the synth look and feel don't draw the particular line around the defined text. I think it is not the normal procedure for synth to draw borders with an additional instance like that from the BorderFactory cause Synth provide methods like paintPanelBorder() to draw the borders. I could build a work a round by setting a special name for the panels that should have a TitledBorder and paint them with the paintPabelBorder() method but if I do that I make my application synth dependent and that is not the solution I'm looking for. Did anybody has suggestions or ideas?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ivo_zlatev
Offline
Joined: 2004-01-29

Hi :)
We had the same problem. Ofcourse your work a round (you described above) works but it is not a solution.

The work a round we used is:

Instaed:

[i]BorderFactory.createTitledBorder("title");[/i]

You should use:

[b][i]Border objBorder = BorderFactory.createLineBorder(Color.black); //Also u can create all the rest borders here.

BorderFactory.createTitledBorder(objBorder, "title");[/i][/b]

[b][/b]

This WORKS!

P.S. My opinion is that when Synth L&F tries to paint the border in your case it use UIManager.getColor(...) and for some reason this doesn't work.