Add even more Antialiasing

This commit is contained in:
Nico Mexis 2021-08-01 12:11:36 +02:00
parent 566527e4a1
commit d26ea523e6
No known key found for this signature in database
GPG key ID: 27D6E17CE092AB78

View file

@ -1,5 +1,7 @@
package the.bytecode.club.bytecodeviewer.gui.hexviewer;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import java.awt.BorderLayout;
@ -160,8 +162,11 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
fn.getHeight() + 1);
}
protected void printString(Graphics g, String s, int x, int y) {
protected void printString(Graphics graphics, String s, int x, int y) {
Graphics2D g = (Graphics2D) graphics;
FontMetrics fn = getFontMetrics(font);
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.drawString(s, ((fn.stringWidth(" ") + 1) * x) + border,
((fn.getHeight() * (y + 1)) - fn.getMaxDescent()) + border);
}