At 12:03 PM 3/6/2001 +0000, Tim Gordon wrote:
>How about
>
>aTextField.setCaretPosition(0);
>
>or am I missing something? Alternatively, you could create a new Document,
>put the text you'd like to see in there and then setDocument() on the text
>field, but that's a bit heavy handed.
Your setCaretPosition approach should work perfectly for him.
Exception: If Ralph Kar is using something other than a
javax.swing.text.DefaultCaret, this might not work. DC is
the caret used by all JTextComponents unless set otherwise,
and it'll force itself to be visible at all times if possible.
>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
>Behalf Of Ralph Kar
>Sent: 06 March 2001 11:44
>To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
>Subject: how do I scroll to the beginning of the content in a JTextField
>
>
>Hi all,
>
>after putting text in a JTextField, which is longer then the width of the
>JTextField, I want to programmatically display the text from the very
>beginning, which means I need to scroll back to the beginning of the text.
>I tried setScrollOffset() and scrollRectToView(), but none of these seem
>to work correctly.
>Is it possile at all?
>
>Greetings,
>Ralph
>
>------------------------------------------------
> Ralph Kar |
> Software Developer | mailto:[EMAIL PROTECTED]
> RTS AG | http://www.rtsgroup.net
>------------------------------------------------
>
>_______________________________________________
>Advanced-swing mailing list
>[EMAIL PROTECTED]
>http://eos.dk/mailman/listinfo/advanced-swing
>
>_______________________________________________
>Advanced-swing mailing list
>[EMAIL PROTECTED]
>http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing