mirror of
https://github.com/processing/processing4.git
synced 2026-02-04 14:19:19 +01:00
fix the About screen, add retina support
This commit is contained in:
@@ -26,7 +26,11 @@ import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
@@ -65,23 +69,38 @@ public class About extends Window {
|
||||
}
|
||||
});
|
||||
|
||||
addKeyListener(new KeyAdapter() {
|
||||
public void keyTyped(KeyEvent e) {
|
||||
System.out.println(e);
|
||||
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Dimension screen = Toolkit.getScreenSize();
|
||||
// setBounds((screen.width-width)/2, (screen.height-height)/2, width, height);
|
||||
setLocationRelativeTo(null);
|
||||
setSize(width, height);
|
||||
// setLocationRelativeTo(null);
|
||||
setLocationRelativeTo(frame);
|
||||
setVisible(true);
|
||||
requestFocus();
|
||||
}
|
||||
|
||||
|
||||
public void paint(Graphics g) {
|
||||
g.drawImage(icon.getImage(), 0, 0, width, height, null);
|
||||
Graphics2D g2 = Toolkit.prepareGraphics(g);
|
||||
g2.scale(0.5, 0.5);
|
||||
|
||||
// Graphics2D g2 = (Graphics2D) g;
|
||||
// g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
// RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
||||
// RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
|
||||
|
||||
g.setFont(Toolkit.getSansFont(Font.PLAIN, 10));
|
||||
//g.setFont(new Font("SansSerif", Font.PLAIN, 10)); //$NON-NLS-1$
|
||||
g.setColor(Color.white);
|
||||
g.drawImage(icon.getImage(), 0, 0, width, height, null);
|
||||
// g.setColor(Color.ORANGE);
|
||||
// g.fillRect(0, 0, width, height);
|
||||
|
||||
g.setFont(Toolkit.getSansFont(12, Font.PLAIN));
|
||||
g.setColor(Color.WHITE);
|
||||
g.drawString(Base.getVersionName(), 26, 29);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user