wl
发贴: 1
积分: 0
|
于 2005-05-23 05:50
edit mask不知道 不过可以在focusLost中检验 sr1.addFocusListener(new org.eclipse.swt.events.FocusAdapter() { public void focusLost(org.eclipse.swt.events.FocusEvent e) { Text text=((Text)e.widget); if (!isTimeValid(text.getText())) { MessageDialog.openError(sShell, "提示", "格式输入错误,请输入如下格式数据\r\r '09:11'"); text.forceFocus(); } }
private boolean isTimeValid(String text) { boolean retval = false; String timeNumberPattern = "(\\d{2})\\\\d{2})"; retval = text.matches(timeNumberPattern); return retval; } });
private boolean isTimeValid(String text) { boolean retval = false; String timeNumberPattern = "(\\d{2})\\\\d{2})"; retval = text.matches(timeNumberPattern); return retval; } });
|