// Job: Jay's Own Browser, a web browser written in Java by Jay Skeer // Copyright (C) 1996 Jay Skeer, Jay Prime Positive // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // /** Subclass of Event which premits nice string names for the kinds of events */ import java.awt.*; public class JppEvent extends Event { public JppEvent() { /* To prevent the compiler error "No constructor matching Event() found in class java.awt.Event. I added this constructor. But, what does Event() have to do with any thing? Why do I need this (bogus) constructor? */ super(null, 0, 0, 0, 0, 0, 0, null); } public String getEventIdName(int id) { switch (id) { case Event.HOME: return "HOME"; case Event.END: return "END"; case Event.PGUP: return "PGUP"; case Event.PGDN: return "PGDN"; case Event.UP: return "UP"; case Event.DOWN: return "DOWN"; case Event.LEFT: return "LEFT"; case Event.RIGHT: return "RIGHT"; case Event.F1: return "F1"; case Event.F2: return "F2"; case Event.F3: return "F3"; case Event.F4: return "F4"; case Event.F5: return "F5"; case Event.F6: return "F6"; case Event.F7: return "F7"; case Event.F8: return "F8"; case Event.F9: return "F9"; case Event.F10: return "F10"; case Event.F11: return "F11"; case Event.F12: return "F12"; // case Event.WINDOW_EVENT: return "WINDOW_EVENT"; case Event.WINDOW_DESTROY: return "WINDOW_DESTROY"; case Event.WINDOW_EXPOSE: return "WINDOW_EXPOSE"; case Event.WINDOW_ICONIFY: return "WINDOW_ICONIFY"; case Event.WINDOW_DEICONIFY: return "WINDOW_DEICONIFY"; case Event.WINDOW_MOVED: return "WINDOW_MOVED"; // case Event.KEY_EVENT: return "KEY_EVENT"; case Event.KEY_PRESS: return "KEY_PRESS"; case Event.KEY_RELEASE: return "KEY_RELEASE"; case Event.KEY_ACTION: return "KEY_ACTION"; case Event.KEY_ACTION_RELEASE: return "KEY_ACTION_RELEASE"; // case Event.MOUSE_EVENT: return "MOUSE_EVENT"; case Event.MOUSE_DOWN: return "MOUSE_DOWN"; case Event.MOUSE_UP: return "MOUSE_UP"; case Event.MOUSE_MOVE: return "MOUSE_MOVE"; case Event.MOUSE_ENTER: return "MOUSE_ENTER"; case Event.MOUSE_EXIT: return "MOUSE_EXIT"; case Event.MOUSE_DRAG: return "MOUSE_DRAG"; // case Event.SCROLL_EVENT: return "SCROLL_EVENT"; case Event.SCROLL_LINE_UP: return "SCROLL_LINE_UP"; case Event.SCROLL_LINE_DOWN: return "SCROLL_LINE_DOWN"; case Event.SCROLL_PAGE_UP: return "SCROLL_PAGE_UP"; case Event.SCROLL_PAGE_DOWN: return "SCROLL_PAGE_DOWN"; case Event.SCROLL_ABSOLUTE: return "SCROLL_ABSOLUTE"; // case Event.LIST_EVENT: return "LIST_EVENT"; case Event.LIST_SELECT: return "LIST_SELECT"; case Event.LIST_DESELECT: return "LIST_DESELECT"; // case Event.MISC_EVENT: return "MISC_EVENT"; case Event.ACTION_EVENT: return "ACTION_EVENT"; case Event.LOAD_FILE: return "LOAD_FILE"; case Event.SAVE_FILE: return "SAVE_FILE"; case Event.GOT_FOCUS: return "GOT_FOCUS"; case Event.LOST_FOCUS: return "LOST_FOCUS"; default: { String base= "UNKNOWN_EVENT"; // if (Event.MISC_EVENT <= id) base= "MISC_EVENT"; // else if (Event.LIST_EVENT <= id) base= "LIST_EVENT"; // else if (Event.SCROLL_EVENT <= id) base= "SCROLL_EVENT"; // else if (Event.MOUSE_EVENT <= id) base= "MOUSE_EVENT"; // else if (Event.KEY_EVENT <= id) base= "KEY_EVENT"; // else if (Event.WINDOW_EVENT <= id) base= "WINDOW_EVENT"; return "?" + base + "+" + Integer.toString(id) + "?"; } } } public String getEventIdName(Event e) { return getEventIdName(e.id); } public String getEventName(Event e) { return getEventIdName(e.id); } public String getEventIdName() { return this.getEventIdName(this.id); } }