Hi all,
Is it possible to insert two different styles of text(example: bold and plain)in a title border?Please do me the favor.Thanks in advance.
Printable View
Hi all,
Is it possible to insert two different styles of text(example: bold and plain)in a title border?Please do me the favor.Thanks in advance.
I don't think its trivial. Lots of swing components allow html to do simple font changes but TitledBorder does not. A workaround is a) google "TitledBorder source code" to retrieve its source code b) modify the paintBorder function in a way that draws each string accordingly using the appropriate font c) incorporate this new object into your project (I'd recommend calling it something else so there isn't conflict with the swing package TitledBorder). Here is an example of what should be done in the paintBorder function to draw "HERE Bold" as the border. If can be modified appropriately for your text
Code :g.drawString("HERE ", textLoc.x, textLoc.y); g.setFont( font.deriveFont(Font.BOLD ) ); g.drawString("Bold", textLoc.x + fm.stringWidth("HERE "), textLoc.y);
Thanks for your reply copeg.Any other possible way?Which borders allow two different size of text in the same title?