Focusable/cursor issue

Hi all,

I currently have a gui, a client chat programe, with two JTextAreas and one send button.

The uppermost, and first, JtextArea displays incoming messages, and the lowermost JTextArea is used to write messages to be sent.

When the gui starts I would like the flashing cursor to be in the bottom JTextArea, ready to write messages to be sent. However it is currently in the uppermost JTextArea, where it should not be.

How do i get it to automatically apear in the bottom JtextArea?

Any help would be greatly appreciated,

Dwarfer

[577 byte] By [Dwarfera] at [2007-11-27 11:33:49]
# 1

secondTextArea.requestFocusInWindow();

Regards,

Stas

StanislavLa at 2007-7-29 16:53:38 > top of Java-index,Desktop,Core GUI APIs...
# 2

Thanks Stas

I had originally tried this (and other requestFocus methods) but to no avail. I found out the problem lay not in an incorrect/missing method call, but its location.

It works when I move the method call to after I call setVisible on the frame.

Dwarfer

Message was edited by:

Dwarfer

Dwarfera at 2007-7-29 16:53:38 > top of Java-index,Desktop,Core GUI APIs...