-1
I have a small error when picking a jtextfield date, error occurs:
String cannot be converted to date
Follows my code:
public TelaControle getVendaFromTela() throws ParseException {
Venda vDaTela = new Venda();
vDaTela.setCliente(inpCliente.getText());
vDaTela.setCarro(inpCarro.getText());
vDaTela.setData(inpData.getText());
return vDaTela;
}
What is this variable question? Where does this getDataAtualDate come from()?
– user28595
If inpData is Jtextfield, how can it have the field "sdf": "inpData.sdf"?
– Douglas
Inpdata is the Jtextfield component that the user inserts the date.
– Eduardo Krakhecke
What getDataAtualDate() does there?
– user28595
In theory getDataAtualDate() is to pick up the current date
– Eduardo Krakhecke
you have to do "inpData.gettext()" to take the date entered by the user as String, and then process it (validate and format it), then put it in vDaTela.
– Douglas
I don’t understand anything, why are you taking the current date from somewhere else, and ,mixing it with a supposed date typed by the user and applying it to a model? Edit the question and explain better what you intend to do, or what this code was supposed to do.
– user28595
I just edited the question. I expressed myself badly when trying to explain
– Eduardo Krakhecke
is getData or setData?
– user28595
the problem is in getData
– Eduardo Krakhecke
@diegofm He just wants to convert a String as "04/20/2016" to a corresponding Date Object, not Eduardo?
– Douglas
correct Douglas
– Eduardo Krakhecke
But there’s nothing getdata in that code.
– user28595
I edited the question. I think it’s now clearer...
– Eduardo Krakhecke