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>JTextField</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 AAJTextField extends JTextField {
30
31 /** Default constructor. */
32 public AAJTextField() {
33 }
34
35 /**
36 * Constructor.
37 *
38 * @param i Int.
39 */
40 public AAJTextField(int i) {
41 super(i);
42 }
43
44 /**
45 * Constructor.
46 *
47 * @param string Label.
48 */
49 public AAJTextField(String string) {
50 super(string);
51 }
52
53 /**
54 * Enables font anti-aliasing in the current graphics context.
55 * <br />
56 *
57 * @param g Graphics context.
58 */
59 public void paint(Graphics g) {
60 ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
61 RenderingHints.VALUE_ANTIALIAS_ON);
62 super.paint(g);
63 }
64
65 }