@Override
		public void keyTyped(KeyEvent e) {
			
			JTextField f = (JTextField) e.getSource();

			// Only accept numbers and decimals in the average mark JTextField
			if ( (!Character.isDigit( e.getKeyChar() )) && (e.getKeyChar() != '.') ) {
				e.consume();
				
				
				// Set and display a helpful tooltip
				f.setToolTipText("Only numbers and decimals allowed");
				try {
		            e.getComponent().dispatchEvent(new KeyEvent(e.getComponent(), KeyEvent.KEY_PRESSED,
		                    System.currentTimeMillis(), InputEvent.CTRL_MASK,
		                    KeyEvent.VK_F1, KeyEvent.CHAR_UNDEFINED));
		        } catch (Exception ex) {/* No need to do anything on Exception */}
			} 
			
			// Only one period allowed in a decimal number
			if (e.getKeyChar() == '.') {
				String text = f.getText();
				if  ( ( text.indexOf('.') != -1 ) && ( text.indexOf('.') != text.length() ) ) {
					e.consume();
				}
			}
			
		}