KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sample > amazon > amazonSimpleQueueService > ListenersIn


1 /*
2 * Copyright 2004,2005 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */

16 package sample.amazon.amazonSimpleQueueService;
17
18 import sample.amazon.amazonSimpleQueueService.util.RunnableCreateQueue;
19
20 import javax.swing.*;
21 import java.awt.event.KeyEvent JavaDoc;
22 import java.awt.event.KeyListener JavaDoc;
23
24 /**
25  * Listeners for relevent Components in the IN operation
26  *
27  * @author Saminda Abeyruwan <saminda@opensource.lk>
28  */

29 public class ListenersIn implements KeyListener JavaDoc {
30     JTextField createQueue;
31     JTextArea result;
32     JTextField queueCode;
33     JTextField enqueue;
34     RunnableCreateQueue runnable;
35
36     public ListenersIn(JTextField createQueue, JTextField queueCode, JTextField enqueue,
37                        JTextArea result) {
38         this.queueCode = queueCode;
39         this.createQueue = createQueue;
40         this.enqueue = enqueue;
41         this.result = result;
42     }
43
44     public void keyPressed(KeyEvent JavaDoc e) {
45         if (e.getKeyCode() == KeyEvent.VK_ENTER) {
46             runnable =
47                     new RunnableCreateQueue(this.createQueue, this.queueCode, this.enqueue,
48                             this.result);
49             Thread JavaDoc tread = new Thread JavaDoc(runnable);
50             tread.start();
51         }
52     }
53
54     public void keyReleased(KeyEvent JavaDoc e) {
55
56     }
57
58     public void keyTyped(KeyEvent JavaDoc e) {
59
60     }
61 }
62
Popular Tags