我想验证文本中的输入。确保该值在 0 到 100 之间。但由于某种原因,我无法使用VerifyEvent
它。如下,我想在公共无效中获得“检查”值handleEvent(Event event)
我该怎么做
control.addListener (SWT.Verify, new Listener () {
public void handleEvent(VerifyEvent e) {
// TODO Auto-generated method stub
Text text = (Text)e.getSource();
String t = text.getText();
String check = t.substring(0, e.start) + e.text + t.substring(e.end);
e.doit = validateInput(check);
}
@Override
public void handleEvent(Event event) {
// TODO Auto-generated method stub
}
});