23 |
package org.jsampler.view.fantasia; |
package org.jsampler.view.fantasia; |
24 |
|
|
25 |
import java.awt.Graphics; |
import java.awt.Graphics; |
26 |
|
import java.awt.Graphics2D; |
27 |
import java.awt.Insets; |
import java.awt.Insets; |
28 |
|
|
29 |
import javax.swing.BorderFactory; |
import javax.swing.BorderFactory; |
38 |
private static java.awt.Color textColor = new java.awt.Color(0xFFA300); |
private static java.awt.Color textColor = new java.awt.Color(0xFFA300); |
39 |
private static Insets pixmapInsets = new Insets(5, 5, 4, 5); |
private static Insets pixmapInsets = new Insets(5, 5, 4, 5); |
40 |
|
|
41 |
|
private boolean antialiased; |
42 |
|
|
43 |
|
/** Creates a new instance of <code>FantasiaLabel</code> */ |
44 |
|
public |
45 |
|
FantasiaLabel(String text) { this(text, false); } |
46 |
|
|
47 |
/** Creates a new instance of <code>FantasiaLabel</code> */ |
/** Creates a new instance of <code>FantasiaLabel</code> */ |
48 |
public |
public |
49 |
FantasiaLabel(String text) { |
FantasiaLabel(String text, boolean antialiased) { |
50 |
super(text); |
super(text); |
51 |
|
this.antialiased = antialiased; |
52 |
setOpaque(false); |
setOpaque(false); |
53 |
setBorder(BorderFactory.createEmptyBorder(4, 3, 6, 5)); |
setBorder(BorderFactory.createEmptyBorder(4, 3, 6, 5)); |
54 |
setForeground(new java.awt.Color(0xFFA300)); |
setForeground(new java.awt.Color(0xFFA300)); |
57 |
|
|
58 |
protected void |
protected void |
59 |
paintComponent(Graphics g) { |
paintComponent(Graphics g) { |
60 |
|
if(antialiased) { |
61 |
|
Graphics2D g2d = (Graphics2D)g; |
62 |
|
|
63 |
|
g2d.setRenderingHint ( |
64 |
|
java.awt.RenderingHints.KEY_TEXT_ANTIALIASING, |
65 |
|
java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON |
66 |
|
); |
67 |
|
} |
68 |
|
|
69 |
PixmapPane.paintComponent(this, g, Res.gfxTextField, pixmapInsets); |
PixmapPane.paintComponent(this, g, Res.gfxTextField, pixmapInsets); |
70 |
super.paintComponent(g); |
super.paintComponent(g); |
71 |
} |
} |