[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Java 1.0.2 keyDown event handling

Posted on 1997-07-03
1
Medium Priority
?
253 Views
Last Modified: 2008-03-06
I need to catch a <Alt>+S key press in a TextArea using the 1.0.2 event model.

a) can I do this with out subclassing the TextArea and

b) if I can how do I, some example code would be great

thanks
0
Comment
Question by:Timothy070397
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
mgk earned 200 total points
ID: 1222644
Try this out:

import java.applet.*;
import java.awt.*;

public class test extends Applet{
   TextArea t;
      
   public void init(){
      t=new TextArea();
      this.setLayout(new BorderLayout());
      this.add("Center",t);
   }
      
   public boolean keyDown(Event e, int key){
      if ((e.modifiers&Event.ALT_MASK)!=0) {
         System.out.println("<ALT>"+(char)e.key);
      }
      else {
         t.appendText(String.valueOf((char)e.key));
      }
      return true;
   }
}
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question