Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2006

Tip: Looking for answers? Try searching our database.

Changing the font of tool tip text

Thread view: 
qu0ll - 22 Dec 2006 09:28 GMT
Is it possible to change the properties of the font used in displaying tool
tip text for a JComponent?

Signature

And loving it,

qu0ll
______________________________________________
qu0llSixFour@gmail.com
(Replace the "SixFour" with numbers to email)

IchBin - 22 Dec 2006 17:35 GMT
> Is it possible to change the properties of the font used in displaying tool
> tip text for a JComponent?

I am sure you can use html in your tooltip. Hence you could define you
font this way.

Signature

Thanks in Advance...                  http://ichbin.9999mb.com
http://weconsultants.phpnet.us
______________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)

Thomas Kellerer - 22 Dec 2006 17:51 GMT
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
Steve W. Jackson - 22 Dec 2006 18:34 GMT
> qu0ll wrote on 22.12.2006 10:28:
> > Is it possible to change the properties of the font used in displaying tool
[quoted text clipped - 18 lines]
>
> 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 =
Signature

Steve W. Jackson
Montgomery, Alabama

qu0ll - 23 Dec 2006 19:29 GMT
> You could override createToolTip() and then set the Font:
>
[quoted text clipped - 6 lines]
>
> haven't tried this though.

Thanks, that did the trick.

Signature

And loving it,

qu0ll
______________________________________________
qu0llSixFour@gmail.com
(Replace the "SixFour" with numbers to email)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.