Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | "Dr.UgoGagliardelli" <do.not.spam@me.please> |
|---|---|
| Newsgroups | it.comp.java |
| Subject | Re: del ed errore |
| Date | 2015-09-27 13:05 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <mu8iih$tvc$1@speranza.aioe.org> (permalink) |
| References | <mu3d0c$qn2$1@speranza.aioe.org> <mu5gb6$a8g$1@speranza.aioe.org> <mu5iq6$fpl$1@speranza.aioe.org> |
Il 26.09.2015 09.48, Gulp® ha scritto:
> Il 26/09/15 09:09, Dr.UgoGagliardelli ha scritto:
>> Il 25.09.2015 13.57, Gulp® ha scritto:
>>> Dopo la cancellazione di una riga di dati, mi compare:
>>>
>>> java.lang.ArrayIndexOutOfBoundsException: -1
>>>
>>> Indica che ho problemi col puntatore?
>>>
>> Definisci 'riga di dati'.
>> Guardati il javaDoc.
>
> Record visualizzato in una javatab.
> Ogni tanto do anche un'occhiata al javaDoc, ma l'inglese non è mio
> amico... :) e faccio un po' fatica.
>
> Grazie comunque sempre per la tua disponibilità. Se continuo in questo
> sforzo con Java è anche grazie a te.
>
> private void EliminaVoce() {
> int selectedRow = GridListino.getSelectedRow();
Supponendo che GridListino sia un oggetto governato da un model, ad
exempio una JTable, dovresti verificare nella documentazione cosa puo'
ritornare getSelectedRow():
http://docs.oracle.com/javase/7/docs/api/javax/swing/JTable.html#getSelectedRow%28%29
che dice:
Returns the index of the first selected row, -1 if no row is selected.
(che anche se non sai l'inglese, il siglificato dovrebbe essere
abbastanza chiaro)
per cui dovresti verificare che il valore ritornato sia non negativo
prima di utilizzarlo, con un semplice if:
if (selectedRow >= 0) {
> sigla=GridListino.getModel().getValueAt(selectedRow,0).toString();
> desc=GridListino.getModel().getValueAt(selectedRow,1).toString();
> conn = DriverManager.getConnection("jdbc:hsqldb:file:" + Path +
> "/dbase/opto","sa","");
> conn.setReadOnly(false);
> st = conn.createStatement();
> st.execute("Delete from \"listino\" Where SIGLA ='" + sigla + "' And
> DEFINIZION='" + desc + "'");
> st.close();
> conn.close();
}
Back to it.comp.java | Previous | Next — Previous in thread | Next in thread | Find similar
del ed errore Gulp® <gulp@hotmail.it> - 2015-09-25 13:57 +0200
Re: del ed errore 4ndre4 <a.laforgia@gmail.com> - 2015-09-25 05:39 -0700
Re: del ed errore Gulp® <gulp@hotmail.it> - 2015-09-26 09:36 +0200
Re: del ed errore rootkit <rootkit@email.it> - 2015-09-26 00:56 -0700
Re: del ed errore Gulp® <gulp@hotmail.it> - 2015-09-26 12:57 +0200
Re: del ed errore rootkit <rootkit@email.it> - 2015-09-26 04:15 -0700
Re: del ed errore Gulp® <gulp@hotmail.it> - 2015-09-26 13:31 +0200
Re: del ed errore 4ndre4 <a.laforgia@gmail.com> - 2015-09-27 01:47 -0700
Re: del ed errore "Dr.UgoGagliardelli" <do.not.spam@me.please> - 2015-09-26 09:09 +0200
Re: del ed errore Gulp® <gulp@hotmail.it> - 2015-09-26 09:48 +0200
Re: del ed errore "Nando" <geremia@tim.it> - 2015-09-26 11:33 +0200
Re: del ed errore Gulp® <gulp@hotmail.it> - 2015-09-26 13:42 +0200
Re: del ed errore 4ndre4 <a.laforgia@gmail.com> - 2015-09-27 01:50 -0700
Re: del ed errore Gulp® <gulp@hotmail.it> - 2015-09-28 15:11 +0200
Re: del ed errore "Dr.UgoGagliardelli" <do.not.spam@me.please> - 2015-09-27 13:05 +0200
Re: del ed errore 4ndre4 <a.laforgia@gmail.com> - 2015-09-27 01:48 -0700
csiph-web