我的问题是您在哪里看到 Font 构造函数,最后一项是字体大小整数,无论是 12 还是 100(就像现在一样),它仍然以相同的大小打印文本。我究竟做错了什么。
@Override
protected void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D g2d = (Graphics2D)g;
Font font = new Font(Font.SERIF, Font.PLAIN, 100);
if(setTextAttributes){
setTextAttributes();
setTextAttributes = false;
}
c.paintCursor( g2d );
font = font.deriveFont(map);
g2d.setFont(font);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
g2d.drawString(text, lineX, lineY);
}