これがドキュメントや少なくとも google にないことに本当に驚いています。
ベリファイアを削除するか、別のものに置き換える必要がある可能性が高いクラスがあります。特に、これらのメソッドはインターフェースで定義されています。
/**
* Add the verifier
*/
public void bind();
/**
* Remove the verifier from input
*/
public void unbind();
実装できますbind
:
/**
* Binds the events to the field using InputVerifier
*/
@Override
public void bind() {
//Internal verifier
final SettingsInputVerifier<T> verif = this.verifier;
//Event to be called if new value is valid
final ValueChanged<T> onchange = this.onchange;
//Only works when you leave the field
field.setInputVerifier(new InputVerifier() {
@Override
public boolean verify(JComponent in) {
//If verification fails, return false and ignore the value
if(!verif.verify(in))
return false;
//Sucessful verification means we get the value and update it
onchange.changed(verif.value(in));
return true;
}
});
}
しかし、どうすればJTextField から入力ベリファイアを設定解除できますか?