Search code examples
javaswingjtextfield

How to format a JTextField so words don't cutoff?


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);

Solution

  • See How to Use Text Areas

    You may also want to take a look at