Могу я спросить, можно ли сделать текст более четким?
Вот как слово «Файл» выглядит в JavaFX:
![JavaFX Text](https://i.stack.imgur.com/aUXUP.png)
And here's how it looks in Swing:
![Swing Text](https://i.stack.imgur.com/fbMmt.png)
The JavaFX one is absolutely better. Is there any way to make the font in Swing look like the one in JavaFX?
P.S. Both of them are using the font "Microsoft YaHei" at 12px
I found a method to open/close anti-alias like
@Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,RenderingHints.VALUE_STROKE_DEFAULT);
g2d.setFont(new Font("Times New Roman", Font.PLAIN, 18));
g2d.drawString("File", 50, 50);
}
But it seems that it does not work well
These are my result in testing different fonts:
Times New Roman
Swing
"Файл" в Times New Roman JavaFX "Файл" в Times new roman