Results 1 to 4 of 4

Thread: Setting JTextArea cursor?

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Question Setting JTextArea cursor?

    Any ideas on how i can do this? I am enabling a JTextArea in another part of a program, so isFocusTraversable() should return true. Now i want to set the cursor from a Key Event but the only way i see how to do this is setting by setting an accelerator key.
    Now the code below should work but it doesn't. Any other way i can do this? Thanks.
    Code:
    public void keyTyped(KeyEvent ke){
        if(screen1.isFocusTraversable()){
             screen1.setFocusAccelerator(ke.getKeyChar());
         }
       }

  2. #2
    Member
    Join Date
    Apr 2001
    Location
    Hamilton, ON, Canada
    Posts
    43
    there is a method processComponentKeyEvent(KeyEvent) and processKeyEvent(KeyEvent)

    i don't know how they work though

    there is also a method setCursor(Cursor)

  3. #3

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    processKeyEvent(KeyEvent) fowards the event to JComponent's processKeyBindingForAllComponents static method. Or so the doc's say.

  4. #4

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    eek Dam im an idiot. Sorry i ment the insertion point not the cursor. Im am enabling a JTextArea but i want to insertion point to come up.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width