| Author |
JTextArea and KeyEvent
|
mira yang
Ranch Hand
Joined: Nov 08, 2003
Posts: 33
|
|
The user put some words in the textArea,and send the message to he friends. i want to add a keylistener ,the code send the message to net when the user press "shift+enter+crtl" .how to do this? Thanks!
|
 |
Ben Zung
Ranch Hand
Joined: Mar 25, 2004
Posts: 109
|
|
Don't understand the question.
"shift+enter+crtl"
Why make it so complicated? Bing
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
Complicated key combination aside, what have you tried? JTextArea text = new JTextArea(); text.addKeyListener(myKeyListener); Have you even tried to do anything?
|
 |
mira yang
Ranch Hand
Joined: Nov 08, 2003
Posts: 33
|
|
"shift+enter+ctrl" means that when all of the three keys are pressed at the same time. i try it this way but it does't do what i want:
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
Originally posted by mira yang: "shift+enter+ctrl" means that when all of the three keys are pressed at the same time. i try it this way but it does't do what i want:
Try
|
 |
mira yang
Ranch Hand
Joined: Nov 08, 2003
Posts: 33
|
|
i tried it but it does't work. is there anyother solution?
|
 |
Ben Zung
Ranch Hand
Joined: Mar 25, 2004
Posts: 109
|
|
I am sorry I still don't see why you want the three key combo. Without testing you may want to setup three booleans And check the keyCode in keyPressed and then check the three booleans to do the trick. HTH. bing
|
 |
mira yang
Ranch Hand
Joined: Nov 08, 2003
Posts: 33
|
|
Thanks ,i got it like this.
|
 |
 |
|
|
subject: JTextArea and KeyEvent
|
|
|