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 / January 2008

Tip: Looking for answers? Try searching our database.

How to turn off Antialiasing in 1.6?

Thread view: 
Alia - 25 Jan 2008 23:43 GMT
I have a need to turn anti-aliasing _off_ for certain jlabels.
My 1.4 code no longer works in 1.6 (setting rendering hints).

I googled around and found various ways to turn antialiasing on, but I have
the opposite problem and reversing the examples I have found doesn't seem
to work.

Does anyone have any example code that will let me turn anti-aliasing off
on a jlabel (without drawing the text myself)?

-Alia
Knute Johnson - 26 Jan 2008 01:32 GMT
> I have a need to turn anti-aliasing _off_ for certain jlabels.
> My 1.4 code no longer works in 1.6 (setting rendering hints).
[quoted text clipped - 7 lines]
>
> -Alia

    *from the soon to be posted updated 2D FAQ :

      Q. How can I specify the text antialiasing/font smoothing
settings to be used by Swing in applications on Java SE 6?

      A. This is generally is a question from users of KDE or Windows
2000 who would like to use LCD subpixel text. There's no programmatic
way to do it in Java SE 6 (However if you know what you want you can set
a system property :

      java -Dawt.useSystemAAFontSettings=lcd which request to use LCD
subpixel text in the most common subpixel configuration There are a few
more useful values for this property as follows :
          o "false" corresponds to disabling font smoothing on the desktop.
          o ""on" corresponds to Gnome Best shapes/Best contrast (no
equivalent Windows desktop setting)
          o ""gasp" corresponds to Windows "Standard" font smoothing
(no equivalent Gnome desktop setting)
          o ""lcd" corresponds to Gnome's "subpixel smoothing" and
Windows "ClearType"

      Posted by: philrace on February 26, 2006 at 05:35 PM

    *
      PS also see :
http://java.sun.com/javase/6/docs/guide/2d/flags.html#aaFonts

Signature

Knute Johnson
email s/nospam/knute/

Roedy Green - 26 Jan 2008 02:54 GMT
>I have a need to turn anti-aliasing _off_ for certain jlabels.
>My 1.4 code no longer works in 1.6 (setting rendering hints).

see http://mindprod.com/jgloss/antialiasing.html
Signature

Roedy Green, Canadian Mind Products
The Java Glossary, http://mindprod.com

Knute Johnson - 26 Jan 2008 05:27 GMT
>> I have a need to turn anti-aliasing _off_ for certain jlabels.
>> My 1.4 code no longer works in 1.6 (setting rendering hints).
>
> see http://mindprod.com/jgloss/antialiasing.html

So is there a way to turn it off for a specific component?  All
anti-aliasing can be turned off with the -D option even if Clear Type is
on.  But if Clear Type is on or the -D option specifies anti-alias on
you can't turn it off in the paintComponent() method.

Signature

Knute Johnson
email s/nospam/knute/

     ------->>>>>>http://www.NewsDem

Roedy Green - 27 Jan 2008 03:30 GMT
On Fri, 25 Jan 2008 21:27:30 -0800, Knute Johnson
<nospam@rabbitbrush.frazmtn.com> wrote, quoted or indirectly quoted
someone who said :

>So is there a way to turn it off for a specific component?  All
>anti-aliasing can be turned off with the -D option even if Clear Type is
>on.  But if Clear Type is on or the -D option specifies anti-alias on
>you can't turn it off in the paintComponent() method.

In JDK 1.6+ there are also new values to use in setRenderingHints key
and value, including VALUE_ANTIALIAS_OFF to turn anti-aliasing off.

http://java.sun.com/javase/6/docs/api/java/awt/RenderingHints.html
Signature

Roedy Green, Canadian Mind Products
The Java Glossary, http://mindprod.com

Knute Johnson - 27 Jan 2008 03:52 GMT
> On Fri, 25 Jan 2008 21:27:30 -0800, Knute Johnson
> <nospam@rabbitbrush.frazmtn.com> wrote, quoted or indirectly quoted
[quoted text clipped - 9 lines]
>
> http://java.sun.com/javase/6/docs/api/java/awt/RenderingHints.html

Apparently you can't stop XP from drawing with Clear Type by selecting
the anti-alias off on the Graphics2D.

Signature

Knute Johnson
email s/nospam/knute/

     ------->>>>>>http://www.NewsDem

Roedy Green - 27 Jan 2008 07:56 GMT
On Sat, 26 Jan 2008 19:52:42 -0800, Knute Johnson
<nospam@rabbitbrush.frazmtn.com> wrote, quoted or indirectly quoted
someone who said :

>Apparently you can't stop XP from drawing with Clear Type by selecting
>the anti-alias off on the Graphics2D.

That sounds like a BUG.
Signature

Roedy Green, Canadian Mind Products
The Java Glossary, http://mindprod.com

Knute Johnson - 27 Jan 2008 18:22 GMT
> On Sat, 26 Jan 2008 19:52:42 -0800, Knute Johnson
> <nospam@rabbitbrush.frazmtn.com> wrote, quoted or indirectly quoted
[quoted text clipped - 4 lines]
>
> That sounds like a BUG.

Or a feature!

Signature

Knute Johnson
email s/nospam/knute/

     ------->>>>>>http://www.NewsDem



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.