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>JPanel</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 AAJPanel extends JPanel {
30
31 /** Default constructor. */
32 public AAJPanel() {
33 }
34
35 /**
36 * Constructor.
37 *
38 * @param layoutManager Layout manager to set.
39 */
40 public AAJPanel(LayoutManager layoutManager) {
41 super(layoutManager);
42 }
43
44 /**
45 * Constructor.
46 *
47 * @param layoutManager Layout manager to set.
48 * @param b Boolean.
49 */
50 public AAJPanel(LayoutManager layoutManager, boolean b) {
51 super(layoutManager, b);
52 }
53
54 /**
55 * Constructor.
56 *
57 * @param b Boolean.
58 */
59 public AAJPanel(boolean b) {
60 super(b);
61 }
62
63 /**
64 * Enables font anti-aliasing in the current graphics context.
65 * <br />
66 *
67 * @param g Graphics context.
68 */
69 public void paint(Graphics g) {
70 ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
71 RenderingHints.VALUE_ANTIALIAS_ON);
72 super.paint(g);
73 }
74
75 }