Focus sur jtexfield

Aurelaine17 Messages postés 11 Date d'inscription lundi 25 octobre 2004 Statut Membre Dernière intervention 24 septembre 2007 - 15 avril 2005 à 17:43
Twinuts Messages postés 5375 Date d'inscription dimanche 4 mai 2003 Statut Modérateur Dernière intervention 14 juin 2023 - 17 avril 2005 à 14:21
Bonjour,

Un peu d'aide SVP, je voudraismettre le focus sur un jtextfield de mon choix mais je n'y arive pas !!!
Quelqu'un aurait-il un bout de code pour m'aider ?????
Merci d'avance

1 réponse

Twinuts Messages postés 5375 Date d'inscription dimanche 4 mai 2003 Statut Modérateur Dernière intervention 14 juin 2023 111
17 avril 2005 à 14:21
Salut,



tu as essayé "jtexfield.requestFocus();"???



pour info:



public void requestFocus()



Description copied from class: Component


Requests that this Component get the input focus, and that this Component's
top-level ancestor become the focused Window. This component must be
displayable, visible, and focusable for the request to be granted. Every effort
will be made to honor the request; however, in some cases it may be impossible
to do so. Developers must never assume that this Component is the focus owner
until this Component receives a FOCUS_GAINED event. If this request is denied
because this Component's top-level Window cannot become the focused Window, the
request will be remembered and will be granted when the Window is later focused
by the user.
This method cannot be used to set the focus owner to no Component at all. Use
KeyboardFocusManager.clearGlobalFocusOwner()
instead.

Because the focus behavior of this method is platform-dependent, developers
are strongly encouraged to use
requestFocusInWindow
when possible.


WORA
0
Rejoignez-nous