简体   繁体   中英

Wrapping text in a text box

I have the following line of code that consists of a text box:

    NameTextCustomers = new JTextField();
NameTextCustomers.setBounds(10, 10, 350, 150);
    Customers.add( NameTextCustomers);

I would like to align the text so it starts at the top left and it wraps within the box. Meaning the words don't disappear off screen, they continue to the next line. I'm not sure what or where to put additional code to accomplish this.

Thanks

You'll probably want to use a JTextArea rather than a JTextField. JTextFields are really meant for a single line of text.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM