Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to set the text in a jtextfield to align to the left

843807Jan 16 2003 — edited Jan 25 2003
A quick simple question. I'm populating a jtextfield with text pulled from a record. However the text is too long to fit in the jtextfield and the alignment is set to the right rather than the left. How do I set the alignment of the text in the jtextfield to be on the left, so that the first character of the string is shown?
I've tried using

setHorizontalAlignmnet(JTextField.LEFT),

but my text still appears right justified in the jtextfield. It means that the user has to scroll the text to go to the beginning of the string, rather than the usual of scrolling the right to go the end of the string.

This has really gotten me stumped!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 22 2003
Added on Jan 16 2003
4 comments
760 views