Re: Activating anti-aliasing in Swing



> java -Dswing.aatext=true Main

Thank you for your suggestion. The JVM is accepting -Dswing.aatext=true
as a valid option, however, it does not appear to do anything, all my
Swing components still render the same. Also, from what Bill said, it
seems like it's not something to use in production code.

At the moment I'm having to override paintComponent for every Swing
component I use to get anti-aliasing working:

public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
super.paintComponent(g2d);
}

Is this really the only way to get anti-aliasing in Swing at the moment
(using 1.4.2), or is there a more elegant way that someone knows of?

Thanks, Jonck

.



Relevant Pages

  • Re: Best way to force a JComponent to repaint itself
    ... perspective of a user of Swing that is more concerned with doing ... Since a Swing component does not seem to me to really be a kind of AWT ... component (would a JButton work properly in an AWT Frame? ... The Swing components are built on top of the AWT system, ...
    (comp.lang.java.programmer)
  • Re: How to update Gui data from application code?
    ... > So what is the proper way then to update your swing components from your ... You don't update the GUI directly. ... For more, see the Swing architecture article in Sun's TSC collection, ... and more advanced GUI questions to comp.lang.java.gui. ...
    (comp.lang.java.programmer)
  • Re: EDT: advanced question regarding whats legal/not
    ... To avoid the possibility of deadlock, you must take extreme care ... queried only from the event-dispatching thread. ... Note that it mentions models specifically, even though all Swing models ...
    (comp.lang.java.gui)
  • Re: Activating anti-aliasing in Swing
    ... > At the moment I'm having to override paintComponent for every Swing ... > component I use to get anti-aliasing working: ... There is a mechanism that provides the Graphics objects to these ... paintComponent methods. ...
    (comp.lang.java.gui)
  • Re: Activating anti-aliasing in Swing
    ... > At the moment I'm having to override paintComponent for every Swing ... > component I use to get anti-aliasing working: ... WrapLF is slightly more elegant. ...
    (comp.lang.java.gui)