Strike through java.awt.Font

后端 未结 3 1692
Happy的楠姐
Happy的楠姐 2021-02-12 16:46

Is there a way to make a java.awt.Font strike through?

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-12 17:35

    So i found this, which works.

    Font font = new Font("helvetica", Font.PLAIN, 12);
    Map  attributes = font.getAttributes();
    attributes.put(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON);
    Font newFont = new Font(attributes); 
    

提交回复
热议问题