Article View: borland.public.jbuilder.java.swing
Article #9286Re: Deleting rows from a jtable
From: Mustapha Essalihe
Date: Thu, 20 Apr 2000 00:00
Date: Thu, 20 Apr 2000 00:00
35 lines
1767 bytes
1767 bytes
In my case, this is the method called for deleting a row from a JTable :
void jButtonDeleteVariable_actionPerformed(ActionEvent e) {
try {
tableVariablesModel.removeRow(jTableVariables.getSelectedRow(););
System.out.println(tableVariablesModel.getRowCount());
} catch (ArrayIndexOutOfBoundsException ex) {
System.out.println(ex.toString());
}
}
But if delete the last row(not the others rows) in the table, the next
time I click on the JTable I obtain an exception.
Sincerly,
Mustapha.
"John P. McGrath" wrote:
> On Tue, 18 Apr 2000 14:20:29 -0400, Mustapha Essalihe wrote:
>
> > Using JTable with a DefaultTableModel, I have two buttons
> > for adding and removing rows respectively from the tableModel
> > and therfore from the table. When I delelte the last row ,
> > I obtain an exception in the next row selection operation,
> > that is not the case for the others rwos to delete. anyone
> > have an idea ?
>
> This sounds like it should work. Can you produce a relatively small
> runnable sample that shows the problem?
>
> --
> John P. McGrath
> <JPMcGrath@fast.net>
> <jpm@nscs.fast.net>
--
Technical Details
Message-ID:
<38FF0B94.455CAF20@iro.umontreal.ca>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<38FCA76D.A8EE4790@iro.umontreal.ca> <MPG.1366fca727617a5898988e@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,1e286d0cd85d827d X-Google-Attributes: gid111d45,public From: Mustapha Essalihe <essalihe@iro.umontreal.ca> Subject: Re: Deleting rows from a jtable Date: 2000/04/20 Message-ID: <38FF0B94.455CAF20@iro.umontreal.ca> X-Deja-AN: 613585551 Content-Transfer-Encoding: 7bit References: <38FCA76D.A8EE4790@iro.umontreal.ca> <MPG.1366fca727617a5898988e@forums.borland.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: CRIM Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing