set a JTextField width in maner to wrap a given text
问题 I have an uneditable and disabled JtextField in which I will put a String obtained after requesting a Database, and I want that this JtextField wraps All my String. I saw the setColumn() and setSize() methods but I don't know first my String length. thank you very much. 回答1: JTextFields can only display a single line of text, period. If you need a simple text component that wraps text, use a JTextArea. Set its columns and rows. Put it into a JScrollPane (if you feel the text will go beyond