Solved

tabbing and enter key for JDK1.1 applet

Posted on 2001-06-19
2
170 Views
Last Modified: 2010-03-31
Hi
I have developed a java(JDK1.1) applet that uses TextFields and Buttons to obtain input from the user.  I would like to be able to set up the ability for
the user to "Tab" and "Enter key" through the fields.
Any help would be appreciated.
0
Comment
Question by:semion50
  • 2
2 Comments
 
LVL 9

Expert Comment

by:Ovi
ID: 6209278
add an KeyListener to thetext field and process there all the key events that are performed by the user.
Please give more details about what have you in mind about the behaviuor of the Tab and Enter keys.
0
 
LVL 9

Accepted Solution

by:
Ovi earned 100 total points
ID: 6209287
import java.awt.event.*;

..........................................
myTextField.addKeyListener(new KeyAdapter() {
  public void keyPressed(KeyEvent ke) {
    switch(ke.getKeyCode()) {
      case KeyEvent.VK_ENTER :
         //do your stuff here
         break;
      case KeyEvent.VK_TAB :
         //do your stuff here
         break;
    }
  }
});
.............................................
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
return in catch statement 1 40
for i loop in grovy 1 32
Free Alternative to JIRA 4 58
Java - Why doesn't this JFrame work 3 18
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now