Java-将JTextArea右对齐

Java-将JTextArea右对齐,第1张

Java-将JTextArea右对齐

尝试使用

JEditorPane
JTextPane
代替
Jtextarea

有关更多信息,请查看此线程在JEditorPane中的文本垂直对齐

样例代码:

JTextPane output = new JTextPane();SimpleAttributeSet attribs = new SimpleAttributeSet();StyleConstants.setAlignment(attribs, StyleConstants.ALIGN_RIGHT);output.setParagraphAttributes(attribs, true);

编辑

你可以试试

Jtextarea jtextarea = new Jtextarea();jtextarea.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5488482.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-12
下一篇2022-12-12

发表评论

登录后才能评论

评论列表(0条)

    保存