[Techtalk] Re: [prog] Java/Swing and antialiased fonts

Dan Richter daniel.richter at wimba.com
Tue Mar 30 19:55:45 EST 2004


[Oops: I sent this to the techtalk mailing list.]

Hi Riccarda!

> Not too long ago, after quite some hunting, I finally managed to get a
> job in the IT sector. With some luck, I was able to convince those
> guys, that I'd be the right one for the job. Yay!!

Great!

Don't let other people look down on you because you're a woman or
because you're self-taught. I taught myself programming before studying
programming in college (uni), and I can tell you that college does bring
theoretical knowledge that you couldn't have figured out yourself - but
not very much, and you can learn it from a book.

On the other hand, don't feel bad when you have to ask other people for
help. Any complex field is too broad for any one person to be an expert
in everything. That's why we're here: to help each other.

> I'm currently working on an application which I took over from someone
> else. The client who's paying for it, seems to have made up his mind,
> that antialiased fonts would look fancier. His wish is my command, so
> it's my job to find out how to implement that...

Uh, gee, I have some experience with Java but I've never had that
question before.

First, it's discussed briefly here:
http://java.sun.com/developer/community/chat/JavaLive/2003/jl0429.html

Hmmm... not good.

I tried to accomplish antialiasing using the following code:

    public class Foo extends Label {

      public void paint(Graphics g) {
        Graphics2D g2 = (Graphics2D)g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                            RenderingHints.VALUE_ANTIALIAS_ON);
        super.paint(g2);
      }
    }

Nope, doesn't work, even when I make the font nice and big.

It looks to me like you're stuck here. Sorry.

-- 
     Presumably, we're all fully qualified computer nerds here,
     so we are allowed to use "access" as a verb. Be advised,
     however, that the practice in common usage drives
     English-language purists to scowling fidgets.
        - from Sybex's "Perl, CGI and JavaScript", p. 256




More information about the Techtalk mailing list