File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes How to use Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to use "setCaretPosition"" Watch "How to use "setCaretPosition"" New topic

How to use "setCaretPosition"

ho mingchang

Joined: Jul 13, 2003
Posts: 3
import java.awt.*;
public class TextAreaExample {
public static void main(String argv[]) {
Frame f = new Frame("TextArea Example");
f.setLayout(new FlowLayout());
String str = "1234567890 234567890 34567890 4567890 567890";
TextArea ta3 = new TextArea(str, 2, 10, TextArea.SCROLLBARS_VERTICAL_ONLY);
When I compiled the file, it showed "Cannot set caret position until after the peer has been created". How should I modify the code?
Thank you very much for your help ^^
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch, ho mingchang!
I'm moving this to the Swing / JFC / AWT forum...
[ July 13, 2003: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: How to use "setCaretPosition"