| Author |
How to use "setCaretPosition"
|
ho mingchang
Greenhorn
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); f.add(ta3); ta3.setCaretPosition(0); f.pack(); f.setVisible(true); } } 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
Sheriff
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]
|
 |
 |
|
|
subject: How to use "setCaretPosition"
|
|
|