Ola colega, faça assim …
try {
MaskFormatter formater;
formater = new MaskFormatter("#########");
tf = new JFormattedTextField(formater);
} catch (ParseException e) {
e.printStackTrace();
}
tfCodigo.setHorizontalAlignment(JTextField.RIGHT);
tfCodigo.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
// Perceba que o delete nao vai funcionar direito use tecla Home e dp DELETE, ou vc pede para o usuario usa a tecla BLACK_SPACE <----------
Concerteza vai da certu, valeu !!!
####1
###11