Cara, seguinte… pensei nesse teu problema, nao sei se da pra fazer sem algumas modificacoes…
Olha soh o q eu meio q implementei aqui… o cara vai digitando o RG dele, se
nao apertar a tecla de ponto ,entao preenche como hj, com ###.###.###-A
Mas, se o cara digitar ponto e esta no meio de um dos numeros, entao crio
uma mascara e seto de novo no JFormattedTextField, por exemplo
##.###.###-A
Se o cara digitar espaço, empurro o ponto mais adiante, por exemplo
####.###.###-A
O codigo esta horrivel, deve estar cheio de bug, a classe MaskFormatter do java
eh foda, eh quase tudo privado, entao tive meio q burlar alguns privates ali,
mas ja eh um comeco pra ti, de repente se eu me animar faco um componente para para isso… 
Ta ai, da uma testada…
package mask;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.lang.reflect.Method;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.MaskFormatter;
/**
* @author fabiofalci
*
*/
public class Rg extends JPanel {
JFormattedTextField rgField;
MaskFormatter mask;
JButton button;
int validChars = 0;
int[] separatorPositions = { 3, 7, 11 };
char[] separators = { '.', '.', '-' };
KeyAdapter keyAdapter = new KeyAdapter() {
@SuppressWarnings("unqualified-field-access")
@Override
public void keyReleased(KeyEvent e) {
JFormattedTextField textField = (JFormattedTextField) e
.getComponent();
if (e.getKeyChar() == '.') {
int position = textField.getCaretPosition();
for (int i = 0; i < separatorPositions.length; i++) {
if (position < separatorPositions[i]) {
addPosition(i, position - separatorPositions[i]);
break;
}
}
setMask(createMask());
rgField.setCaretPosition(position);
} else if (e.getKeyCode() == KeyEvent.VK_SPACE) {
int position = textField.getCaretPosition();
for (int i = 0; i < separatorPositions.length; i++) {
if (position < separatorPositions[i]) {
addPosition(i, 1);
break;
}
}
setMask(createMask());
rgField.setCaretPosition(position);
}
}
};
public Rg() {
this.add(this.getRgField());
this.add(this.getButton());
}
public JFormattedTextField getRgField() {
if (this.rgField == null) {
this.rgField = new JFormattedTextField(this.getMaskFormatter(this
.createMask()));
this.rgField.addKeyListener(this.keyAdapter);
this.rgField.setPreferredSize(new Dimension(100, 22));
}
return this.rgField;
}
public void addPosition(int from, int number) {
for (; from < this.separatorPositions.length; from++) {
this.separatorPositions[from] += number;
}
}
public String createMask() {
String number = "#";
String separator = ".";
StringBuffer buffer = new StringBuffer();
int charPosition = 0;
int separatorPosition = 0;
int size = this.separatorPositions[this.separatorPositions.length - 1];
while (charPosition < size) {
if (separatorPosition < this.separatorPositions.length
&& this.separatorPositions[separatorPosition] == charPosition) {
buffer.append(separator);
separatorPosition++;
} else {
buffer.append(number);
}
charPosition++;
}
buffer.append("-A");
System.out.println(buffer.toString());
return buffer.toString();
}
public MaskFormatter getMaskFormatter(String strMask) {
try {
this.mask = new MaskFormatter(strMask);
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
this.mask.setValueContainsLiteralCharacters(false);
return this.mask;
}
public void setMask(String strMask) {
String text = this.rgField.getText();
try {
Method method = this.mask.getClass().getDeclaredMethod(
"stringToValue",
new Class[] { String.class, boolean.class });
method.setAccessible(true);
text = (String) method.invoke(this.mask,
new Object[] { text, false });
} catch (Exception ex) {
ex.printStackTrace();
}
text = text.trim();
System.out.println();
MaskFormatter mask = this.getMaskFormatter(strMask);
DefaultFormatterFactory d = new DefaultFormatterFactory(mask);
this.rgField.setFormatterFactory(d);
this.rgField.setValue(text);
}
public JButton getButton() {
if (this.button == null) {
this.button = new JButton("OK");
this.button.setPreferredSize(new Dimension(200, 22));
this.button.addActionListener(new ActionListener() {
@SuppressWarnings("unqualified-field-access")
public void actionPerformed(@SuppressWarnings("unused")
ActionEvent e) {
System.out.println(rgField.getText());
String d = rgField.getText();
try {
System.out.println((rgField.getFormatter()
.stringToValue(d)).toString());
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
}
return this.button;
}
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(new Rg());
frame.setSize(500, 300);
frame.setVisible(true);
}
}