Hi I am a bit of a newb when it comes to programming so please bare
with me!
This is what I have for one of my JPanels (called inputPanel)
titles...
inputPanel.setBorder(BorderFactory.createTitledBorder("Script
Options"));
My Question is, how can I change that line so that the TitledBorder
has white text and the font to be ("Verdana", Font.PLAIN, 10)? (With
everything else such as justification and line as default).
I have searched high and Low on these forums but I have not been able
to find a solution.
Please can somebody help me!
:D
ak - 10 Feb 2004 07:58 GMT
> I have searched high and Low on these forums but I have not been able
> to find a solution.
why you search here - better search javadocs!
> My Question is, how can I change that line so that the TitledBorder
> has white text and the font to be ("Verdana", Font.PLAIN, 10)? (With
> everything else such as justification and line as default).
TitledBorder#setTitleColor
TitledBorder#setTitleFont
--
____________
http://reader.imagero.com the best java image reader.
Thomas Weidenfeller - 10 Feb 2004 08:01 GMT
> inputPanel.setBorder(BorderFactory.createTitledBorder("Script
> Options"));
>
> My Question is, how can I change that line so that the TitledBorder
> has white text and the font to be ("Verdana", Font.PLAIN, 10)? (With
> everything else such as justification and line as default).
You usually don't do this. You let the Look and Feel define the colors
and default sizes. That way you don't end up with applications that look
like a circus clown who made it into a GUI.
But if you don't care, read the API documentation of BorderFactory. Note
that method which takes a font and a color as argument too?
> I have searched high and Low on these forums but I have not been able
> to find a solution.
This is not a forum, this is a newsgroup.
> Please can somebody help me!
Please don't whine.
/Thomas
powarsg - 29 Nov 2004 10:41 GMT
Do following things at start up.....
UIDefaults defaults = UIManager.getDefaults();
Font f = FTUtilities.getFont("Verdana",Font.PLAIN,10);
defaults.put("TitledBorder.font", f);
defaults.put("TitledBorder.titleColor",new Color(white));
here white is RGB combination for white color
Christian Kaufhold - 29 Nov 2004 12:43 GMT
> UIDefaults defaults = UIManager.getDefaults();
> Font f = FTUtilities.getFont("Verdana",Font.PLAIN,10);
> defaults.put("TitledBorder.font", f);
> defaults.put("TitledBorder.titleColor",new Color(white));
Use ColorUIResource and FontUIResource.
Do not change global settings unless necessary.
Christian