Results 1 to 9 of 9
- 12-09-2009, 10:16 AM #1
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
Vector/Table Deleting Row Problem.
Hi I use Vectors with my Tables. When I Remove a row and then insert a new. It first sends empty rows equal to the number of deleted, before inserting the new one. I use code below to delete rows.
It´s most likley that i need to update/remove from the vector to ?Java Code:removeOrderButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event){ int getRow; getRow = handleAllTable.getSelectedRow(); handleAllModel.removeRow(getRow-1); } });
- 12-09-2009, 11:30 AM #2
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
Solved it, Had to create a function that removed and refreshed vector and tables. And reset an variable that hold the number of rows that were sent.
- 12-09-2009, 11:31 AM #3
Jeez, that sounds like you really abused a TableModel.
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 12-09-2009, 01:02 PM #4
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
Why is that? Please tell me, critique makes me learn new things.
- 12-09-2009, 01:49 PM #5
The DefaultTableModel does all that by itself with very little tweaking from you.
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 12-09-2009, 02:02 PM #6
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
Thank you for telling me that, I now found out were the real problem is.
I need to remove 1 from the variable that hold rowcount, when i remove a row.
Java Code:countAddRows=countAddRows-1;
- 12-09-2009, 04:32 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,412
- Blog Entries
- 7
- Rep Power
- 17
- 12-09-2009, 04:42 PM #8
Amen, brother! ;)
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 12-09-2009, 06:39 PM #9
Senior Member
- Join Date
- Sep 2009
- Location
- Sweden/Borås
- Posts
- 107
- Rep Power
- 0
Mabey i have made it more difficult then it has to be. Itś like this.
I have a combobox that i can select project to work on. Each project has 2 tables. From the first table ill send 3 column to the 3rd table and from the second table ill send 4 columns. Then i work on the data from the third table and send it to be calculated, and saved.
I need to keep track on how many rows and so on i send. Mabey there is a better way to do it. And I will take a look at it. Remember Im just a few month old with Java. But I will start school 25 January with Java and will hopefully be as good as you guys. If thats possible.
But it all works now. And im proud of all I have learned just by searching on the internet.
Best Reagards / Ocean
Similar Threads
-
Problem with vector
By morghul in forum New To JavaReplies: 3Last Post: 11-04-2009, 02:24 AM -
Static Vector Problem
By calicocal in forum New To JavaReplies: 12Last Post: 11-09-2008, 11:31 PM -
Deleting records from database table using PreparedStatement
By Java Tip in forum Java TipReplies: 0Last Post: 02-09-2008, 08:31 PM -
Vector problem
By Ace_Of_John in forum New To JavaReplies: 1Last Post: 01-27-2008, 08:53 PM -
vector problem
By mambo_jumbo in forum New To JavaReplies: 1Last Post: 11-17-2007, 10:44 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks