if (key != NO_KEY && (key=='1'||key=='2'||key=='3'||key=='4'||key=='5'||key=='6'||key=='7'||key=='8'||key=='9'||key=='0')){
Since the values '0' to '9' are all covered by this statement, it could be a lot shorter:
if (key >= '0' && key <= '9')
{