Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #479

Re: Changing the font of

From "Steve W. Jackson" <steve.w..jackson@THRWHITE.remove-dii-this>
Subject Re: Changing the font of
Message-ID <stevewjackson-0C87C2.12345422122006@individual.net> (permalink)
Newsgroups comp.lang.java.gui
References <4v2k87F1aosl9U1@mid.individual.net>
Date 2011-04-27 15:27 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
In article <4v2k87F1aosl9U1@mid.individual.net>,
 Thomas Kellerer <TAAXADSCBIXW@spammotel.com> wrote:

> qu0ll wrote on 22.12.2006 10:28:
> > Is it possible to change the properties of the font used in displaying tool 
> > tip text for a JComponent?
> > 
> 
> You could override createToolTip() and then set the Font:
> 
> public JTooltip createToolTip()
> {
>    JToolTip tip = super.createToolTip();
>    tip.setFont(myFont);
>    return tip;
> }
> 
> haven't tried this though.
> 
> 
> If you want to change it globally, you can do this by applying the necessary 
> UIDefaults *before* creating the first Swing Component.
> 
> UIDefaults def = UIManager.getDefaults();
> def.put("ToolTip.font", myFont);
> 
> Thomas

As to the UIDefaults part, I'm pretty sure I've read that the preferred 
way of doing what's suggested here would be to use a FontUIResource 
rather than a Font.  The former subclasses the latter, and its API 
Javadoc description says that "UI classes which set default font 
properties should use this class."  It has constructors accepting a Font 
or the name, style and size as can be used with a Font.

= Steve =
-- 
Steve W. Jackson
Montgomery, Alabama

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Changing the font of tool "qu0ll" <qu0ll@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
  Re: Changing the font of "IchBin" <ichbin@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
  Re: Changing the font of "Thomas Kellerer" <thomas.kellerer@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
    Re: Changing the font of "Steve W. Jackson" <steve.w..jackson@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
    Re: Changing the font of "qu0ll" <qu0ll@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000

csiph-web