Article View: borland.public.jbuilder.java.swing
Article #11076Re: Change the font of ToolTipText
From: wim.van.leuven
Date: Wed, 14 Jul 1999 00:00
Date: Wed, 14 Jul 1999 00:00
76 lines
2393 bytes
2393 bytes
In article <7mg4jb$t513@forums.borland.com>,
"Anil Kumar" <a@b.com> wrote:
> Try this. It's tested using JDK1.2. Let me know if this works.
>
> JButton button3 = new JButton("Next")
> {
> public JToolTip createToolTip()
> {
> JToolTip tt = new JToolTip();
> tt.setFont(new Font("Courier", Font.BOLD, 12));
> return tt;
> }
> };
> button3.setToolTipText("Click here for Next");
>
> Let me know if this works.
> -Anil Kumar
>
> Boris Villazon wrote in message
> <3784F5D9.E6315D30@estudiantes.ucbcba.edu.bo>...
> >Hi:
> >
> >I want to change the font of the tooltiptext.
> >
> >I proved with jtooltip but it don't make changes.
> >
> >How can I do this?
> >
> >Thanks in advance
> >
> > Boris Villaz�n
> >
>
>
Hello,
I'm presuming that you are using the swing classes and that you want to
change the font for ALL tooltips. The way how to do this is through the
L&F manager:
import javax.swing.*;
import javax.swing.plaf.FontUIResource;
import java.awt.Font;
public class Application
{
//Main method
public static void main(String[] args)
{
try
{
UIDefaults defaults = UIManager.getLookAndFeel().getDefaults();
Font font = new Font("Dialog", Font.BOLD, 12);
FontUIResource fontUI = new FontUIResource(font));
defaults.put("ToolTip.font", fontUI);
}
catch (Exception e)
{
e.printStackTrace();
}
.... // The rest of your code goes here
}
}
Hope to be of any help.
Bye,
Wim Van Leuven
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Technical Details
Message-ID:
<7mhcfs$9u5$1@nnrp1.deja.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3784F5D9.E6315D30@estudiantes.ucbcba.edu.bo> <7mg4jb$t513@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111d45,b7722a2c22626d17 X-Google-Attributes: gid111d45,public From: wim.van.leuven@watco.be Subject: Re: Change the font of ToolTipText Date: 1999/07/14 Message-ID: <7mhcfs$9u5$1@nnrp1.deja.com> X-Deja-AN: 500819889 References: <3784F5D9.E6315D30@estudiantes.ucbcba.edu.bo> <7mg4jb$t513@forums.borland.com> X-Http-Proxy: 1.0 x36.deja.com:80 (Squid/1.1.22) for client 193.74.148.91 Organization: Deja.com - Share what you know. Learn what you don't. X-Article-Creation-Date: Wed Jul 14 06:59:11 1999 GMT Newsgroups: borland.public.jbuilder.java.swing X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)