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.Graphics;
18 import java.awt.Graphics2D;
19 import java.awt.RenderingHints;
20 import javax.swing.JTextField;
21
22 /**
23 * Object of this class represents a <code>JTextField</code>
24 * that has font anti-aliasing enabled in the graphics context
25 * when rendering this component.
26 * <p/>
27 * Created date: Jan 28, 2008
28 *
29 * @author Yevgeny Nyden
30 */
31 public class AAJTextField extends JTextField {
32
33 /** Default constructor. */
34 public AAJTextField() {
35 }
36
37 /**
38 * Constructor.
39 *
40 * @param i Int.
41 */
42 public AAJTextField(int i) {
43 super(i);
44 }
45
46 /**
47 * Constructor.
48 *
49 * @param string Label.
50 */
51 public AAJTextField(String string) {
52 super(string);
53 }
54
55 /**
56 * Enables font anti-aliasing in the current graphics context.
57 * <br />
58 *
59 * @param g Graphics context.
60 */
61 @Override
62 public void paint(Graphics g) {
63 ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
64 RenderingHints.VALUE_ANTIALIAS_ON);
65 super.paint(g);
66 }
67
68 }