01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: JAntialiasedLabel.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.swing;
09:
10: import java.awt.Graphics;
11: import java.awt.Graphics2D;
12: import java.awt.RenderingHints;
13: import javax.swing.Icon;
14: import javax.swing.JLabel;
15:
16: public class JAntialiasedLabel extends JLabel {
17: private static final long serialVersionUID = -5909786319590631081L;
18:
19: public JAntialiasedLabel() {
20: super ();
21: }
22:
23: public JAntialiasedLabel(Icon image) {
24: super (image);
25: }
26:
27: public JAntialiasedLabel(Icon image, int horizontalAlignment) {
28: super (image, horizontalAlignment);
29: }
30:
31: public JAntialiasedLabel(String text) {
32: super (text);
33: }
34:
35: public JAntialiasedLabel(String text, Icon icon,
36: int horizontalAlignment) {
37: super (text, icon, horizontalAlignment);
38: }
39:
40: public JAntialiasedLabel(String text, int horizontalAlignment) {
41: super (text, horizontalAlignment);
42: }
43:
44: public void paint(Graphics g) {
45: Graphics2D g2d = (Graphics2D) g;
46: g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
47: RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
48: g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
49: RenderingHints.VALUE_ANTIALIAS_ON);
50: super.paint(g2d);
51: }
52: }
|