How to Change Font Size in drawString Java

前端 未结 6 1682
清歌不尽
清歌不尽 2021-02-02 07:33

How to make the font size bigger in g.drawString(\"Hello World\",10,10); ?

6条回答
  •  一生所求
    2021-02-02 08:12

    g.setFont(new Font("TimesRoman", Font.PLAIN, fontSize)); 
    

    Where fontSize is a int. The API for drawString states that the x and y parameters are coordinates, and have nothing to do with the size of the text.

提交回复
热议问题