• Post Reply Bookmark Topic Watch Topic
  • New Topic

i try to get the VK_TAB in jtextfield but i cant,here is the code what i doing wrong? the other keys

 
ben oshran
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is the code...
private void jTextField18KeyReleased(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
if(evt.getKeyCode()==KeyEvent.VK_CONTROL){
jTextField3.setFocusable(true);
jTextField3.requestFocusInWindow();
}
}

buy the way i generate the code with netbeans...
 
Darryl Burke
Bartender
Posts: 5155
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ben oshran wrote:this is the code...

buy the way i generate the code with netbeans...

Why? The visual designer is an advanced tool. Until you're familiar with the Swing API and coding idioms, you're better off hand-coding your GUIs.

That said, your subject says
i try to get the VK_TAB in jtextfield
whereas the posted code uses KeyEvent.VK_CONTROL. And in any case, every KeyEvent is not guaranteed to be populated with the keyCode and/or keyChar. And as I remarked in your other thread, please use correct capitalization for the first word in a sentence, proper nouns, the first person singular I, and Java class and member names.

On a more fundamental level, what exactly are you trying to achieve? (Note: what, not how you are trying to achieve it.)
 
ben oshran
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to achive that i will put info in one jTextField and after that i will press the tab key and forward to other component that i want...
the code i use is :


any help?
 
Darryl Burke
Bartender
Posts: 5155
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i will press the tab key and forward to other component

For that, using a KeyListener isn't the right approach. See the first paragraph of my response in this recent thread for the right way to go about it.

And once again, please use proper capitalization.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!