F
Federico
Hello,
I'm fighting with a JTextField and don't find how to call getText
everytime the text is changed. I tried the code shown below
(automatically generated by NetBeans) but it does nothing (never prints
"Hola").
I tried to add a KeyListener for keyTyped and it works but when I call
getText the last key typed is not there.
Do you know what happens?
(I'm working on a Mac OSX with java 1.4.2_05)
Thanks in advance,
Federico
jTextField1.addInputMethodListener(new
java.awt.event.InputMethodListener() {
public void
inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
jTextField1InputMethodTextChanged(evt);
}
public void
caretPositionChanged(java.awt.event.InputMethodEvent evt) {
jTextField1CaretPositionChanged(evt);
}
});
private void jTextField1InputMethodTextChanged(
java.awt.event.InputMethodEvent evt) {
// TODO add your handling code here:
System.err.println("Hola");
}
I'm fighting with a JTextField and don't find how to call getText
everytime the text is changed. I tried the code shown below
(automatically generated by NetBeans) but it does nothing (never prints
"Hola").
I tried to add a KeyListener for keyTyped and it works but when I call
getText the last key typed is not there.
Do you know what happens?
(I'm working on a Mac OSX with java 1.4.2_05)
Thanks in advance,
Federico
jTextField1.addInputMethodListener(new
java.awt.event.InputMethodListener() {
public void
inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
jTextField1InputMethodTextChanged(evt);
}
public void
caretPositionChanged(java.awt.event.InputMethodEvent evt) {
jTextField1CaretPositionChanged(evt);
}
});
private void jTextField1InputMethodTextChanged(
java.awt.event.InputMethodEvent evt) {
// TODO add your handling code here:
System.err.println("Hola");
}