Estou tendo problemas em fazer inclusão e alteração com métodos JFormattedTextField
Para métodos com JTextField sem mascara não tenho problemas
Segue meus métodos e o Select de inclusão
Obrigado desde já
Select
SQL =“INSERT INTO operacao (cfop,descricaonota,ipireducao)”
SQL +=“VALUES (’”+jftCFOP.getText()+"’,’"+jtDescricaoNota.getText()
+"’,’"+jftredIPI.getText()+"’)";
Estrutura da Tabela operação
cfop varchar(10)
descricaonota varchar(100)
ipireducao decimal(10,6)
Meus Métodos
private JTextField getJtDescricaoNota() {
if (jtDescricaoNota == null) {
jtDescricaoNota = new JTextField();
jtDescricaoNota.setBounds(new java.awt.Rectangle(7,73,728,20));
}
return jtDescricaoNota;
}
private JFormattedTextField getFormattedTextField() throws java.text.ParseException{
MaskFormatter m_cfop;
try {
m_cfop = new MaskFormatter("###.###");
m_cfop.setValidCharacters("0123456789");
jftCFOP = new javax.swing.JFormattedTextField(m_cfop);
jftCFOP.setFocusLostBehavior(JFormattedTextField.COMMIT);
jftCFOP.setSize(new java.awt.Dimension(81,20));
jftCFOP.setLocale(new java.util.Locale("pt", "BR", ""));
jftCFOP.setEnabled(false);
jftCFOP.setLocation(new java.awt.Point(42,9));
} catch (ParseException e) {
e.printStackTrace();
}
return jftCFOP;
}
private JFormattedTextField getJftretIPI() {
MaskFormatter m_redIPI;
try {
try {
m_redIPI = new MaskFormatter("#####.##");
m_redIPI.setValidCharacters("0123456789");
jftredIPI = new javax.swing.JFormattedTextField(m_redIPI);
jftredIPI.setFocusLostBehavior(JFormattedTextField.COMMIT);
jftredIPI.setSize(new java.awt.Dimension(69,20));
jftredIPI.setLocale(new java.util.Locale("pt", "BR", ""));
// jftredIPI.setText(" .00");
jftredIPI.setLocation(new java.awt.Point(51,240));
} catch (java.text.ParseException e) {
e.printStackTrace();
}
} catch (ParseException e) {
e.printStackTrace();
}
return jftredIPI;
}