aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTextArea display Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTextArea display" Watch "JTextArea display" New topic
Author

JTextArea display

sai thilak
Greenhorn

Joined: Dec 28, 2004
Posts: 4
I have a problem with JTextArea in my application.

The requirement of one of the application screens is to display the text of length (max) 60 characters in maximum of 11 rows. I have implemented this in JTextArea.

Now, the problem is, the text of subsquent lines or any two lines, of equal number of chracters (say 60) are not ending at the same point, though the lines starts at same point. This proves the character size is making problem. Depending upon the character size, the length (physical not characters)of the string(line) is changing.

I observed in text editors like "TextPad", the text get some kind of optimisation, so irrespective of the character size, the characters follow same width.

How to fix this problem, making the characters to have same width and display the text properly?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
set the textArea's font to a monospaced one
 
jQuery in Action, 2nd edition
 
subject: JTextArea display