mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Fixed text antialiasing for FButtons.
This commit is contained in:
@@ -20,7 +20,6 @@ public class FButton extends JButton {
|
||||
protected Image imgL, imgM, imgR;
|
||||
private int w, h = 0;
|
||||
private boolean allImagesPresent = false;
|
||||
private RenderingHints rh;
|
||||
private FSkin skin;
|
||||
private AlphaComposite disabledComposite =
|
||||
AlphaComposite.getInstance(AlphaComposite.SRC_OVER,0.25f);
|
||||
@@ -32,16 +31,11 @@ public class FButton extends JButton {
|
||||
this.setForeground(skin.txt1a);
|
||||
this.setBackground(Color.red);
|
||||
this.setContentAreaFilled(false);
|
||||
this.setFont(skin.font1.deriveFont(Font.PLAIN,14));
|
||||
this.setFont(skin.font1.deriveFont(Font.BOLD,15));
|
||||
this.imgL = skin.btnLup.getImage();
|
||||
this.imgM = skin.btnMup.getImage();
|
||||
this.imgR = skin.btnRup.getImage();
|
||||
|
||||
rh = new RenderingHints(
|
||||
RenderingHints.KEY_ANTIALIASING,
|
||||
RenderingHints.VALUE_ANTIALIAS_ON
|
||||
);
|
||||
|
||||
if(this.imgL != null && this.imgM != null && this.imgR != null) {
|
||||
allImagesPresent = true;
|
||||
}
|
||||
@@ -77,7 +71,14 @@ public class FButton extends JButton {
|
||||
}
|
||||
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
g2d.setRenderingHints(rh);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
|
||||
RenderingHints.VALUE_RENDER_QUALITY);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
|
||||
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
|
||||
|
||||
if(!isEnabled()) {
|
||||
g2d.setComposite(disabledComposite);
|
||||
|
||||
@@ -117,9 +117,9 @@ public class WinLoseFrame extends JFrame {
|
||||
this.btnRestart = new FButton("Restart");
|
||||
this.btnQuit = new FButton("Quit");
|
||||
|
||||
pnlFoot.add(btnContinue,"h 36:36, w 150, gap 0 0 5 5, align center");
|
||||
pnlFoot.add(btnRestart,"h 36:36, w 150, gap 0 0 5 5, align center");
|
||||
pnlFoot.add(btnQuit,"h 36:36, w 150, gap 0 0 5 5, align center");
|
||||
pnlFoot.add(btnContinue,"h 36:36, w 200!, gap 0 0 5 5, align center");
|
||||
pnlFoot.add(btnRestart,"h 36:36, w 200!, gap 0 0 5 5, align center");
|
||||
pnlFoot.add(btnQuit,"h 36:36, w 200!, gap 0 0 5 5, align center");
|
||||
|
||||
// Button actions
|
||||
btnQuit.addActionListener(new java.awt.event.ActionListener() {
|
||||
|
||||
Reference in New Issue
Block a user