You could define a custom class that derives from JFormattedTextField and use KeyListener to get the raw text that the user is typing:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyFormattedTextField extends JFormattedTextField { | |
private String rawText; | |
private class MyKeyListener implements KeyListener { | |
... | |
@Override | |
public void keyTyped(KeyEvent e) { | |
rawText = getText(); | |
} | |
} | |
public MyFormattedTextField() { | |
addKeyListener(new MyKeyListener()); | |
} | |
public String getRawText() { | |
return rawText; | |
} | |
} |
No comments:
Post a Comment