Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
JThequeLabel |
|
| 1.0;1 |
1 | package org.jtheque.core.managers.view.impl.components; | |
2 | ||
3 | /* | |
4 | * This file is part of JTheque. | |
5 | * | |
6 | * JTheque is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License. | |
9 | * | |
10 | * JTheque is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
19 | import org.jtheque.core.managers.view.ViewComponent; | |
20 | ||
21 | import javax.swing.JLabel; | |
22 | import java.awt.Color; | |
23 | import java.awt.Font; | |
24 | import java.awt.Graphics; | |
25 | import java.awt.Graphics2D; | |
26 | import java.awt.RenderingHints; | |
27 | ||
28 | /** | |
29 | * An internationalizable label. | |
30 | * | |
31 | * @author Baptiste Wicht | |
32 | */ | |
33 | public final class JThequeLabel extends JLabel implements ViewComponent { | |
34 | /** | |
35 | * Construct a new <code>JThequeLabel</code>. | |
36 | * | |
37 | * @param text The text of the label. | |
38 | */ | |
39 | public JThequeLabel(String text) { | |
40 | 0 | super(text); |
41 | 0 | } |
42 | ||
43 | /** | |
44 | * Construct a new <code>JThequeLabel</code>. | |
45 | * | |
46 | * @param text The text of the label. | |
47 | * @param font The font to use. | |
48 | */ | |
49 | public JThequeLabel(String text, Font font) { | |
50 | 0 | this(text); |
51 | ||
52 | 0 | setFont(font); |
53 | 0 | } |
54 | ||
55 | /** | |
56 | * Construct a new <code>JThequeLabel</code>. | |
57 | * | |
58 | * @param text The text of the label. | |
59 | * @param font The font to use. | |
60 | * @param foreground The foreground color. | |
61 | */ | |
62 | public JThequeLabel(String text, Font font, Color foreground) { | |
63 | 0 | this(text); |
64 | ||
65 | 0 | setFont(font); |
66 | 0 | setForeground(foreground); |
67 | 0 | } |
68 | ||
69 | @Override | |
70 | public void paint(Graphics g) { | |
71 | 0 | ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); |
72 | ||
73 | 0 | super.paint(g); |
74 | 0 | } |
75 | ||
76 | @Override | |
77 | public Object getImpl(){ | |
78 | 0 | return this; |
79 | } | |
80 | } |