How to Change Font Size in drawString Java

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

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

6条回答
  •  自闭症患者
    2021-02-02 07:56

    Font myFont = new Font ("Courier New", 1, 17);
    

    The 17 represents the font size. Once you have that, you can put:

    g.setFont (myFont);
    g.drawString ("Hello World", 10, 10);
    

提交回复
热议问题