Problemas JFormattedTextField

Pessoal estou fazendo uns testes com javax.swing.JFormattedTextField, porem estou com um problema, seu eu digito um dado válido no javax.swing.JFormattedTextField ele não deixa eu apagar.
Ex.
Seu eu não digitar nada o javax.swing.JFormattedTextField me retorna isso -> '( ) - ’
ai eu coloco o seguinte dado no JFormattedTextField -> ‘(11) 1111-1111’
se eu tentar apagar os dados do JFormattedTextField ele não apaga sempre fica o ultimo valor digitado, no caso ‘(11) 1111-1111’.
Alguem sabe como apagar o valor, não sei oque estou fazendo errado, segue o código abaixo.

	try {
			txtTelMask.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##) ####-####")));
		} catch (java.text.ParseException ex) {
			ex.printStackTrace();
		}

Oi Luivilella,
veja se este tópico te ajuda.
http://javafree.uol.com.br/topic-850615-MaskFormatter.html
Se vc não entender dá um grito aqui.
Abs

Nada ainda da uma olhada como eu estou fazendo meus testes.

package gui;

import javax.swing.text.MaskFormatter;

@SuppressWarnings("serial")
public class Teste extends javax.swing.JFrame {

	public Teste() {
		initComponents();
	}

	private void initComponents() {

		txtTelMask = new javax.swing.JFormattedTextField();
		btnBotaoTel = new javax.swing.JButton();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setMaximumSize(new java.awt.Dimension(600, 600));
		setPreferredSize(new java.awt.Dimension(600, 600));
		setSize(new java.awt.Dimension(600, 600));
		getContentPane().setLayout(null);

		try {
			txtTelMask.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(mascara("telefone")));
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		getContentPane().add(txtTelMask);
		txtTelMask.setBounds(120, 70, 260, 28);

		btnBotaoTel.setText("jButton1");
		btnBotaoTel.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnBotaoTelActionPerformed(evt);
			}
		});
		getContentPane().add(btnBotaoTel);
		btnBotaoTel.setBounds(140, 110, 97, 29);

		pack();
	}

	private void btnBotaoTelActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnBotaoTelActionPerformed
		System.out.println(txtTelMask.getText());
		if (txtTelMask.getText().equals("(  )    -    ")) {
			System.out.println("vazio");
		}
	}

	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				new Teste().setVisible(true);
			}
		});
	}

	private javax.swing.JButton btnBotaoTel;
	private javax.swing.JFormattedTextField txtTelMask;

	private MaskFormatter mascara(String s) {
		MaskFormatter formato = null;
		try {
			if (s == "codigo")
				formato = new MaskFormatter("####");
			else if (s == "mesano")
				formato = new MaskFormatter("######");
			else if (s == "cnpj")
				formato = new MaskFormatter("##.###.###/####-##");
			else if (s == "data") {
				formato = new MaskFormatter("*#/##/####");
				formato.setValidCharacters("0123456789Hh");
			} else if (s == "cep")
				formato = new MaskFormatter("#####-###");
			else if (s == "telefone")
				formato = new MaskFormatter("(##)####-####");
			formato.setPlaceholderCharacter(' ');
			formato.setCommitsOnValidEdit(true);
			formato.setValueContainsLiteralCharacters(false);
		} catch (java.text.ParseException e) {
			e.printStackTrace();
		}
		return formato;
	}

}

Olá,
fiz os testes aqui e percebi que está tudo OK.
O que acontece é que vc setou um formato para ele, quando vc apaga numeros e aperta enter vc tenta forçar ele a exibir algo que não está formatado para exibir, por isso ele exibe a última formatação válida.
Experimente apagar e trocar por outro numero preenchendo corretamente e ele exibirá a sequencia correta.
O que vc pode fazer é tratar este campo pra caso alguem tente digitar no campo de forma incompleta e ele exibir um erro.

Entendeu?

Abs.

www.raulferreira.com.br

Tipo eu percebi que se você digitar outro válido vai, porem se eu digitar qlqr coisa inválida ele sempre volta a ultima válida.
Então como tratar inválido, se ele sempre traz a ultima válida.
Repare nas sysout.

O q vc quer que apareça, mensagem dizendo que esta errado ou quer que o campo seja resetado.[url]?

outra coisa… troca o seu == por equals, pois o que vc está tratando é string.

Abs

Gostaria de Resetar o campo, para que o usuário possa deixar em branco.

Acredito que o problema possa ser resolvido alterando o atributo focusLostBehaviour()

...
try {
   MaskFormatter maskCpf = new MaskFormatter("###.###.###-##");
} catch (Exception e) {
   e.printStackTrace();
}

JFormattedTextField txtCpf = new JFormattedTextField(maskCpf);
txtCpf.setFocusLostBehavior(JFormattedTextField.PERSIST);//<<== AQUI
...

Espero ter ajudado