View Javadoc

1   /*
2    * Copyright 2007 Markku Saarela 
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, 
11   * software distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. 
14   * See the License for the specific language governing permissions and limitations under the License. 
15   */
16  package net.sourceforge.jivalo.editor.key;
17  
18  import java.awt.event.KeyEvent;
19  
20  /**
21   * @author <a href="mailto:ivalo@iki.fi">Markku Saarela</a>
22   *
23   */
24  public class KeyCode
25  {
26  
27      /**
28       * Name of key.
29       * @see java.awt.event.KeyEvent
30       */
31      private String name;
32      
33      /**
34       * Key code value.
35       * @see java.awt.event.KeyEvent
36       */
37      private int keyCode;
38      
39      /**
40       * @param name javax.swing.text.DefaultEditorKit static field name
41       * @param action javax.swing.text.DefaultEditorKit static field value
42       */
43      public KeyCode( String name, int keyCode )
44      {
45          super();
46          this.name = name;
47          this.keyCode = keyCode;
48          
49      }
50  
51      /**
52       * @return the name
53       */
54      public String getName()
55      {
56          return this.name;
57      }
58  
59      /**
60       * @return the keyCode
61       */
62      public int getKeyCode()
63      {
64          return this.keyCode;
65      }
66  
67      /**
68       * @see java.lang.Object#toString()
69       */
70      public String toString()
71      {
72          return KeyEvent.getKeyText( this.keyCode );
73  
74      }
75      
76      
77          
78  }