1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Text text = new Text( group ,SWT.BORDER);
text.bound(50,50,200,100);
text.setText("");
text.setToolTipText("-p=");
text.addListener (SWT.Verify, new Listener () {
public void handleEvent (Event e) {
String string = e.text;
char [] chars = new char [string.length ()];
string.getChars (0, chars.length, chars, 0);
for (int i=0; i<chars.length; i++) {
if (!('0' <= chars [i] && chars [i] <= '9')) {
e.doit = false;
return;
}
}
}
});
if ( text.getText() != "" )
{
System.out.println( text.getToolTipText()+text.getText() ); |