Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Showing Beginning of Text in JTextField by Default

 
Scott Florez
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have several JTextFields of a set size that I fill with text read from a database. Some of that data is larger than the JTextFields and thus requires the user to "scroll" sideways to view all of the data. However, when data is read this way, the default view shows the last part of the text instead of the first part. How do I set the JTextFields' default view to show the beginning of the text? Thanks!
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried setCaretPosition( 0 );
 
Scott Florez
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mathias Nilsson:
Have you tried setCaretPosition( 0 );


That's what I needed. Thanks a lot!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic