>>I have two text panes, one on top of window other one below (this is for an
>>IM window..)
[quoted text clipped - 22 lines]
> }
> });
hmmm... first of all, Michael, thank you very much.. have not
forgotten, of course, all the help you gave me when I was trying to do
my little IM window..
ok, the focus thing is working now.. used the following:
textAreaTop.transferFocus();
textAreaBottom.grabFocus();
but you say use requestFocusInWindow() instead? what does this do
exactly? I did read about it in the docs, but well, don't quite get the
deal w/this method ("Every effort will be made to honor the request;
however, in some cases it may be impossible to do so.." ;)
this focus thing is a bit more complex than it would seem at first
glance, I guess to allow for more complex applications that my present
one...;)
question I have now is re caret: after I send message, and msg appears
in top textArea, if the msg is more than one line long, let's say two
lines, caret stays at line 2 in bottom window.. how do I make caret go
back to top line in that bottom textArea after msg has been sent? (just
spent some time looking @ caret methods, only one that I found that
moves caret is moveCaretPosition(), but that one is used to form
selections..)
speaking of selections, I also would like to know if can set font
color/shading color for selections, for ex, if a user selects a word
make font color gray, shading dark blue for that selection.. again,
many thanks for yr help, Michael.. Frances
Frances - 06 Oct 2005 14:55 GMT
>>> I have two text panes, one on top of window other one below (this is
>>> for an IM window..)
[quoted text clipped - 53 lines]
> make font color gray, shading dark blue for that selection.. again,
> many thanks for yr help, Michael.. Frances
hmmmm.... just realized, while top area is a JTextPane, bottom one is a
JTextArea (since don't need to do diff. font colors for that one) can u
manipulate caret position on a JTextArea? thanks again...
Andrew Thompson - 06 Oct 2005 17:12 GMT
> hmmmm.... just realized, while top area is a JTextPane, bottom one is a
> JTextArea (since don't need to do diff. font colors for that one) can u
> manipulate caret position on a JTextArea?
Can you manipulate the caret in a text component?
(Check the Javadocs, then check which two classes,
amongst others, inheret those methods from
JTextComponent)
Roedy Green - 06 Oct 2005 20:18 GMT
>hmmmm.... just realized, while top area is a JTextPane, bottom one is a
>JTextArea (since don't need to do diff. font colors for that one) can u
>manipulate caret position on a JTextArea? thanks again..
a JTextArea is a JTextComponent and as such inherits methods such as
setSelectionStart, setCaret, setCaretColor

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Michael Dunn - 06 Oct 2005 20:34 GMT
> but you say use requestFocusInWindow() instead? what does this do
> exactly?
from the api docs
"The focus behavior of this method can be implemented uniformly across
platforms, and thus developers are strongly encouraged to use this method
over requestFocus when possible. Code which relies on requestFocus may
exhibit different focus behavior on different platforms."
> how do I make caret go back to top line in that bottom textArea after msg
> has been sent?
textArea.setCaretPosition(0);