6349N/A/*
6349N/A * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
6349N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6349N/A *
6349N/A * This code is free software; you can redistribute it and/or modify it
6349N/A * under the terms of the GNU General Public License version 2 only, as
6349N/A * published by the Free Software Foundation.
6349N/A *
6349N/A * This code is distributed in the hope that it will be useful, but WITHOUT
6349N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6349N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6349N/A * version 2 for more details (a copy is included in the LICENSE file that
6349N/A * accompanied this code).
6349N/A *
6349N/A * You should have received a copy of the GNU General Public License version
6349N/A * 2 along with this work; if not, write to the Free Software Foundation,
6349N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6349N/A *
6349N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6349N/A * or visit www.oracle.com if you need additional information or have any
6349N/A * questions.
6349N/A */
6349N/A
6349N/Aimport javax.swing.*;
6349N/Aimport java.awt.*;
6349N/Aimport java.awt.Color;
6349N/Aimport java.awt.Label;
6349N/Aimport java.awt.TextArea;
6349N/Aimport java.awt.event.KeyAdapter;
6349N/Aimport java.awt.event.KeyEvent;
6349N/Aimport java.lang.String;
6349N/Aimport java.lang.System;
6349N/A
6349N/A
6349N/Apublic class TestApplet extends JApplet {
6349N/A
6349N/A public void init() {
6349N/A final TextArea log = new TextArea("Events:\n");
6349N/A log.setEditable(false);
6349N/A log.setSize(400, 200);
6349N/A this.add(log);
6349N/A log.addKeyListener(
6349N/A new KeyAdapter() {
6349N/A @Override public void keyTyped(KeyEvent e) {
6349N/A log.append("Key typed: char = " + e.getKeyChar() + "\n");
6349N/A }
6349N/A
6349N/A @Override public void keyPressed(KeyEvent e) {
6349N/A log.append("Key pressed: char = " + e.getKeyChar() + " code = " + e.getKeyCode() + "\n");
6349N/A }
6349N/A
6349N/A @Override public void keyReleased(KeyEvent e) {
6349N/A log.append("Key released: char = " + e.getKeyChar() + " code = " + e.getKeyCode() + "\n");
6349N/A }
6349N/A });
6349N/A }
6349N/A
6349N/A public void start() {
6349N/A }
6349N/A
6349N/A public void stop() {
6349N/A }
6349N/A
6349N/A public void destroy() {
6349N/A }
6349N/A
6349N/A}