Re: Cursor in an uneditable textpane? (or getting chars as they are typed)



I just discovered that getting the caret via
JTextPane t ...
Caret c= t.getCaret();
.....
c.setVisible(true);
works for the given situation

/daniel

>Hi,
>I have an application that's lets the user type text into a JTextPane.
>I transmit this text char by char as it is typed (requirement for the
>application) over the network. This means that I can not let the user
>type anywhere s/he wants but only at the end of the currently typed
>text. At present this is done by setting the textpane notEnabled and
>then via a keyListener instert the text char by char myself into the
>pane.
>Now it's not very good for the user not to have a cursor while typing,
>so can I get a cursor visible and still only allow the user to
>insert(i.e type) text at the very end of the text?
>
>---
>Daniel
>http://www.daik.se

.



Relevant Pages

  • Re: Cursor in an uneditable textpane? (or getting chars as they are typed)
    ... > I have an application that's lets the user type text into a JTextPane. ... > I transmit this text char by char as it is typed (requirement for the ... Change the caret to alway stay at the end. ...
    (comp.lang.java.gui)
  • Re: caret on not editable JTextPane
    ... > I have a JTextPane which works fine. ... the caret is not visible. ... public class CaretInText extends JPanel { ...
    (comp.lang.java.programmer)
  • Re: type directly on graphic object: caret ?
    ... Any actual "coding" idea on how to make and manage the caret? ... TextBox control, I think you'll find that the caret stuff is still ... not be much problem with GDI+, using measurestring or char. ... response to the key press. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: type directly on graphic object: caret ?
    ... TextBox control, I think you'll find that the caret stuff is still ... Search for .Net wrappers for the following Win32 API functions: ... not be much problem with GDI+, using measurestring or char. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Showing text cursor in JTextPane
    ... Jim Rootham wrote: ... Could the cursor be sitting at the end of the text in the JTextPanes? ... I do want the caret not to show if the JTextPane does not have focus. ...
    (comp.lang.java.gui)