How to make JTextPane
to accept only numbers and the following symbols: .
, ,
(dot and coma) in Java?
private void jTextPane6KeyTyped(java.awt.event.KeyEvent evt) {
char c = evt.getKeyChar();
if ((Character.isLetter(c) && !(c==KeyEvent.VK_BACKSPACE) || (c==KeyEvent.VK_DELETE))) {
getToolkit().beep();
evt.consume();
}
}