home *** CD-ROM | disk | FTP | other *** search
- package netscape.application;
-
- import netscape.util.ClassInfo;
- import netscape.util.Codable;
- import netscape.util.CodingException;
- import netscape.util.Decoder;
- import netscape.util.Encoder;
-
- public class KeyStroke implements Codable {
- int key;
- int modifiers;
- static final String KEY_KEY = "key";
- static final String MODIFIERS_KEY = "modifiers";
-
- public KeyStroke() {
- }
-
- public KeyStroke(int var1, int var2) {
- this.key = var1;
- this.modifiers = var2;
- }
-
- public KeyStroke(KeyEvent var1) {
- this(var1.key, var1.modifiers);
- }
-
- public int key() {
- return this.key;
- }
-
- public int modifiers() {
- return this.modifiers;
- }
-
- public boolean equals(Object var1) {
- if (!(var1 instanceof KeyStroke)) {
- return false;
- } else if (this.key == ((KeyStroke)var1).key && this.modifiers == ((KeyStroke)var1).modifiers) {
- return true;
- } else if ((this.modifiers & 2) > 0) {
- int var2 = ((KeyStroke)var1).key() + 64;
- int var3 = this.key;
- if (var2 >= 97 && var2 <= 122) {
- var2 -= 32;
- }
-
- if (var3 >= 97 && var3 <= 122) {
- var3 -= 32;
- }
-
- return var2 == var3;
- } else {
- return false;
- }
- }
-
- public boolean matchesKeyEvent(KeyEvent var1) {
- if (var1 == null) {
- return false;
- } else {
- return var1.type == -11 && var1.key == this.key && var1.modifiers == this.modifiers;
- }
- }
-
- public int hashCode() {
- return ("" + this).hashCode();
- }
-
- public String toString() {
- return "KeyStroke (" + this.key + "," + this.modifiers + ")";
- }
-
- public void describeClassInfo(ClassInfo var1) {
- var1.addClass("netscape.application.KeyStroke", 1);
- var1.addField("key", (byte)8);
- var1.addField("modifiers", (byte)8);
- }
-
- public void encode(Encoder var1) throws CodingException {
- var1.encodeInt("key", this.key);
- var1.encodeInt("modifiers", this.modifiers);
- }
-
- public void decode(Decoder var1) throws CodingException {
- this.key = var1.decodeInt("key");
- this.modifiers = var1.decodeInt("modifiers");
- }
-
- public void finishDecoding() throws CodingException {
- }
- }
-