java - JTextArea Transfer Focus -


i'm trying transfer focus 1 jtextarea when user hits tab. i'm using code:

public void keytyped(keyevent e) {                           if(e.getkeychar() == keyevent.vk_tab){             entertextarea.transferfocus();         }                } 

this appears work - focus moves , type in next jtextarea - text stills gets appened first textarea, meaning performing gettext() on second textarea returns "".

how make text typed go second jtextarea rather appended first?

edit: on further inspection behavior caused separate bug. no further needed.

you can transfer text 1 2 using gettext on first one.

public void keytyped(keyevent e) {                       if(e.getkeychar() == keyevent.vk_tab){         entertextarea.transferfocus();         string firstfield = textfield1.gettext();         secondfield.settext(firstfield);     }                } 

that way save first text area, , put second one.

hope helps!


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -