The Artima Developer Community
Sponsored Link

Java Answers Forum
activating JTextFields

1 reply on 1 page. Most recent reply: Jun 13, 2004 3:31 AM by mausam

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Gibran Shah

Posts: 27
Nickname: gibby
Registered: Jun, 2004

activating JTextFields Posted: Jun 11, 2004 2:00 PM
Reply to this message Reply
Advertisement
Hey,

I'm programming an interface with several JTextFields, and some error checking once the user hits submit. IT goes through each text field, and if it detects a problem it returns to the form so the user can make the necessary corrections. The problem is that I want the cursor to be in the correct TextField. I've got something along the lines of:

TextField.setCaretPosition(TextField.getText().length());

but no cursor seems to be placed into the textfield. My guess is there must be an activateTextfield() function or something, but I can't find anything of the kind in the documentation. Does anyone know how to do this?

Gibran


mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: activating JTextFields Posted: Jun 13, 2004 3:31 AM
Reply to this message Reply
http://java.sun.com/j2se/1.3/docs/api/java/awt/Component.html#requestFocus()
requestFocus
 
public void requestFocus()
 
    Requests that this component get the input focus. The component must be visible on the screen for this request to be granted
 
Since:
JDK1.0

Flat View: This topic has 1 reply on 1 page
Topic: Need help for modify CreditCard program. Previous Topic   Next Topic Topic: ejb beans

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use