forked from External/mage
Minor changes
This commit is contained in:
parent
653f236c65
commit
59a2eaafd8
2 changed files with 76 additions and 4 deletions
|
|
@ -0,0 +1,73 @@
|
|||
package mage.client.components.ext;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author mw, noxx
|
||||
*/
|
||||
public class ShadowLabel extends JLabel {
|
||||
|
||||
private String text;
|
||||
|
||||
private Font f;
|
||||
|
||||
private boolean invertColors = false;
|
||||
|
||||
public ShadowLabel() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ShadowLabel(String text, int size) {
|
||||
super();
|
||||
this.text = text;
|
||||
f = new Font("Dialog", 1, size);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
|
||||
Graphics2D g2D = (Graphics2D) g;
|
||||
// ////////////////////////////////////////////////////////////////
|
||||
// antialiasing
|
||||
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
// ////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* draw text
|
||||
*/
|
||||
if (!invertColors) {
|
||||
g2D.setFont(f);
|
||||
g2D.setColor(new Color(0, 0, 0));
|
||||
g2D.drawString(this.text, 1, 11);
|
||||
g2D.setColor(new Color(255, 255, 255, 230));
|
||||
g2D.drawString(this.text, 0, 10);
|
||||
} else {
|
||||
g2D.setFont(f);
|
||||
g2D.setColor(new Color(255, 255, 255, 230));
|
||||
g2D.drawString(this.text, 1, 11);
|
||||
g2D.setColor(new Color(0, 0, 0));
|
||||
g2D.drawString(this.text, 0, 10);
|
||||
}
|
||||
g2D.dispose();
|
||||
|
||||
}
|
||||
|
||||
public void setInvertColors(boolean invertColors) {
|
||||
this.invertColors = invertColors;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
repaint();
|
||||
}
|
||||
|
||||
/**
|
||||
* Default UID
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue