Solved

tabbing and enter key for JDK1.1 applet

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

776 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