?
Solved

tabbing and enter key for JDK1.1 applet

Posted on 2001-06-19
2
Medium Priority
?
178 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
[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
  • 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 300 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

718 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