wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes calculate sum in jtable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "calculate sum in jtable" Watch "calculate sum in jtable" New topic
Author

calculate sum in jtable

Lia Mihaela
Greenhorn

Joined: Jun 15, 2010
Posts: 6
Hello!
I am beginner in java and I don't know to do this operation: column "Valoare" = column "Intrari" * column "Pret achizitie", where "Intrari" is editable

I hope you understand me, I don't speak English very well

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Welcome to the Ranch.

Please be sure to take the time to compose descriptive subjects for your posts. You will attract people who will can give you better and faster answers when your posts have good, descriptive subjects. For more information, please click this link ⇒ UseAMeaningfulSubjectLine.

Using a title such as "table" isn't going to attract the attention of those who can best help you.

You can change your subject line by clicking the button on your post.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I don't understand the question. You do that calculation in your database query. Then you do it again in line 106 of the code you posted, which is unnecessary but should not be a problem.

So what's your problem with this code? Try reading this: TellTheDetails.
Lia Mihaela
Greenhorn

Joined: Jun 15, 2010
Posts: 6
I have in may table columns: Intrari, [Pret achizitie], Valoare
I want to calculate Intrari*[Pret achizitie] and the result should appear in Valoare, but when I enter a value in Intrari and press enter nothing happens in Valoare
Peter Taucher
Ranch Hand

Joined: Nov 18, 2006
Posts: 174
OK, here's a simple example calculating column C = A * B (simple multiplication inside a row). Colum A and B are editable and when their contents change the result (column C) is recalculated. Depending on your code you may have different cell editors for the table, in my example there're only Double colums, so it's simplified.



Censorship is the younger of two shameful sisters, the older one bears the name inquisition.
-- Johann Nepomuk Nestroy
Lia Mihaela
Greenhorn

Joined: Jun 15, 2010
Posts: 6
Thanks, thanks, thanks, it worked
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Devendra Ghag,
Your post was moved to a new topic.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: calculate sum in jtable
 
Similar Threads
Calculate sum in jtable and display the sum in jtextfield
Swing--JTable in JInternalFrame
Need Help in Modification MultiRowHeaderExample
how to delete row from Jtable
Need Help in Modification MultiRowHeaderExample