View Javadoc

1   /**
2    * This program is free software: you can redistribute it and/or modify
3    * it under the terms of the GNU General Public License as published by
4    * the Free Software Foundation, version 3.
5    *
6    * This program is distributed in the hope that it will be useful,
7    * but WITHOUT ANY WARRANTY; without even the implied warranty of
8    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9    * GNU General Public License for more details.
10   *
11   * You should have received a copy of the GNU General Public License
12   * along with this program. If not, see <http://www.gnu.org/licenses/>.
13   */
14  
15  package net.curre.prefcount.gui.aa;
16  
17  import java.awt.*;
18  import javax.swing.*;
19  
20  /**
21   * Object of this class represents a <code>JOptionPane</code>
22   * that has font anti-aliasing enabled in the graphics context
23   * when rendering this component.
24   * <p/>
25   * Created date: Jan 28, 2008
26   *
27   * @author Zhenya Nyden
28   */
29  public class AAJOptionPane extends JOptionPane {
30  
31    /**
32     * Constructor.
33     *
34     * @param object        Object.
35     * @param infMessage    Information message to set.
36     * @param defaultOption Default option to set.
37     * @param icon          Icon to set.
38     */
39    public AAJOptionPane(Object object, int infMessage, int defaultOption, Icon icon) {
40      super(object, infMessage, defaultOption, icon);
41    }
42  
43    /**
44     * Enables font anti-aliasing in the current graphics context.
45     * <br />
46     *
47     * @param g Graphics context.
48     */
49    public void paint(Graphics g) {
50      ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
51                                        RenderingHints.VALUE_ANTIALIAS_ON);
52      super.paint(g);
53    }
54  
55  }