java/swing: converting a text string to a Shape

后端 未结 3 717
悲哀的现实
悲哀的现实 2020-12-06 06:29

I want to convert some arbitrary text to a Shape (java.awt.Shape) and then stroke/fill the Shape to draw it. How can I do this?

3条回答
  •  难免孤独
    2020-12-06 06:47

    Use the TextLayout class (see the getOutline() method). Theres an example here

提交回复
热议问题