InputMethodListener

InputMethodListener - Java - Programmation

Marsh Posté le 27-03-2003 à 21:36:46    

Quelqu'un aurait coder ça sans se taper toutes les définitions des interfaces et tout le toutim ? parce que dans la javadoc on me dit addInputMethodListener marche si getInputMethodRequests renvoie un InputMethodRequests, alors je commence à voir pour coder tout ça, et là il faudrait que je code toutes les méthodes de l'interface InputMethodRequests et je me dit : "Bwof, c'est juste pour un texte qui change, il y a qd meme pas 100 lignes de codes à taper !?!"
 
Mon but : avoir un Event lorsque le texte change dans un JTextField.
 
Merci bien.
 
PS : La methode qui m'intéresse est  
 

Code :
  1. void  inputMethodTextChanged(InputMethodEvent event)
  2. Invoked when the text entered through an input method has changed.


Message édité par Gwarm le 27-03-2003 à 21:42:19
Reply

Marsh Posté le 27-03-2003 à 21:36:46   

Reply

Marsh Posté le 27-03-2003 à 22:56:47    

:heink:  Je ne saisis pas ton problème ...
 

Code :
  1. public class TonListener implements InputMethodListener {
  2.   public void caretPositionChanged(InputMethodEvent event) {
  3.   }
  4.   public  void inputMethodTextChanged(InputMethodEvent event) {
  5.      // Gerer event
  6.   }
  7. }


 
 

Code :
  1. TonListener tonListener = new TonListener();
  2. tonTextFiled.addInputMethodListener(tonListener);


---------------
Just because you feel good does not make you right
Reply

Marsh Posté le 28-03-2003 à 15:27:43    

Oui, c'est déjà ce que j'ai fait, je lui ai mis un "System.out.println("Action" );" et l'évènement n'est pas catché.
 
 

Code :
  1. public void addInputMethodListener(InputMethodListener l)
  2. Description copied from class: Component
  3. Adds the specified input method listener to receive input method events from this component. A component will only receive input method events from input methods if it also overrides getInputMethodRequests to return an InputMethodRequests instance. If listener l is null, no exception is thrown and no action is performed.


 
A component will only receive input method events from input methods if it also overrides getInputMethodRequests to return an InputMethodRequests instance.
 
Je n'ai quand même pas si mal traduit que ça.


Message édité par Gwarm le 28-03-2003 à 15:28:42
Reply

Marsh Posté le 28-03-2003 à 16:06:23    

Je pige pas trop le pb, mais si ca peut t'aider :
 http://forum.hardware.fr/forum2.ph [...] h=&subcat=


---------------
get amaroK plugin
Reply

Marsh Posté le 28-03-2003 à 23:11:49    

GWaRm a écrit :

Oui, c'est déjà ce que j'ai fait, je lui ai mis un "System.out.println("Action" );" et l'évènement n'est pas catché.
 
 

Code :
  1. public void addInputMethodListener(InputMethodListener l)
  2. Description copied from class: Component
  3. Adds the specified input method listener to receive input method events from this component. A component will only receive input method events from input methods if it also overrides getInputMethodRequests to return an InputMethodRequests instance. If listener l is null, no exception is thrown and no action is performed.


 
A component will only receive input method events from input methods if it also overrides getInputMethodRequests to return an InputMethodRequests instance.
 
Je n'ai quand même pas si mal traduit que ça.


 
tu as regardé la source de JTextField? :o


---------------
Just because you feel good does not make you right
Reply

Marsh Posté le 29-03-2003 à 12:27:06    

J'ai pas le réflexe. Je vais voir ça

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed