如何格式化JTextField以使单词不截止?(How to format a JTextField so words don't cutoff?)
我有一个JTextField,它会切断我的输入,使句子超过界限,而不是每5个字左右开始一个新行。 我曾经尝试过这个适用于JLabel而不适用于JtextField的内容:
String html1 = "<html><body style='width: "; String html2 = "px'>"; labell.setText(html1+"300"+html2+content);I have a JTextField which cuts off my input making the sentence go on past the bounds instead of starting a new line every 5 words or so. I have tried in the past this which has worked for a JLabel but not for JtextField:
String html1 = "<html><body style='width: "; String html2 = "px'>"; labell.setText(html1+"300"+html2+content);最满意答案
请参见如何使用文本区域
您可能还想看看
JTextArea#setLineWrap JTextArea#setWrapStyleWord JTextArea#setRows JTextArea#setColumnsSee How to Use Text Areas
You may also want to take a look at
JTextArea#setLineWrap JTextArea#setWrapStyleWord JTextArea#setRows JTextArea#setColumns更多推荐
发布评论