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
Solved

tabbing and enter key for JDK1.1 applet

Posted on 2001-06-19
2
173 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
diffSum example 4 50
Java string replace 11 54
Facing this issue for maven proxy setting 2 20
Java class and jar 3 20
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

808 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