简体   繁体   中英

Java TextArea Get Possible Amount of Characters at Line

I would like to know if its possible to know how many characters a line can have programatically. I already searched but didn't found any useful..

Basically I want to fill a line with the same character, but just one entire line.

Thanks in advance ;)

You could instead use a JTextField like so...

 JTextField text_field = new JTextField(25);

Here you can see we've preset the field to be able to hold up to a maximum of 25 characters

Off the top of my head, but perhaps one of these

getColumns()
getColumnWidth()
getRows()
getRowWidth()

will work? If you want to fill the line, just use a for loop and the insert(str, index) method.

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