how to total figures in a JTable column

Discussion in 'Java' started by Mike, Oct 21, 2003.

  1. Mike

    Mike Guest

    Hi,

    how can I iterate over each cell in a particular column of a jtable and sum
    the figures to get a numerical total.

    thanks

    Mike
    Mike, Oct 21, 2003
    #1
    1. Advertising

  2. Mike

    Paul Lutus Guest

    Mike wrote:

    > Hi,
    >
    > how can I iterate over each cell in a particular column of a jtable and
    > sum the figures to get a numerical total.


    Access the column cells, get their text contents, convert to doubles, add
    them together. Like you, speaking hypothetically.

    Instead of asking hypothetical questions, why not post your code and ask
    real ones?

    --
    Paul Lutus
    http://www.arachnoid.com
    Paul Lutus, Oct 21, 2003
    #2
    1. Advertising

  3. Mike

    Mike Guest


    > Instead of asking hypothetical questions, why not post your code and ask
    > real ones?


    Because I am very pressed for time and wondered if there was any example
    code out there - I have searched but didn't come accross anything

    Mike
    Mike, Oct 22, 2003
    #3
  4. "Mike" <> writes:
    > how can I iterate over each cell in a particular column of a jtable and sum
    > the figures to get a numerical total.


    Iterate (loop) over the column data in the model, not in the JTable.

    /Thomas
    Thomas Weidenfeller, Oct 22, 2003
    #4
  5. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    In article <niilb.552$>, on Tue, 21 Oct
    2003 23:19:54 +0100, "Mike"
    <> wrote:

    | Hi,
    |
    | how can I iterate over each cell in a particular column of a jtable and sum
    | the figures to get a numerical total.

    [[http://www.codeguru.com/java/articles/136.shtml]
    [Dynamically compute and display the column total in a cell]]

    <davidp />

    - --
    David Postill

    -----BEGIN PGP SIGNATURE-----
    Version: PGP 8.0.2 - not licensed for commercial use: www.pgp.com
    Comment: Get key from pgpkeys.mit.edu:11370

    iQA/AwUBP5XDdnxp7q1nhFwUEQKNsACfZw8T2nUMwLBU0Mbwh9jaLUG3/3wAoIvF
    kv+UhghmG+Rjli1tlrF0l9l6
    =9xEY
    -----END PGP SIGNATURE-----
    David Postill, Oct 22, 2003
    #5
  6. Mike

    Mike Guest

    thanks for pointing me in the right direction, I have it now

    Mike

    <> wrote in message
    news:niilb.552$...
    > Hi,
    >
    > how can I iterate over each cell in a particular column of a jtable and

    sum
    > the figures to get a numerical total.
    >
    > thanks
    >
    > Mike
    >
    >
    Mike, Oct 22, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tivo Escobar
    Replies:
    1
    Views:
    7,269
    manusa
    Apr 12, 2007
  2. Andrew Thompson

    Update figures for Plug-In size?

    Andrew Thompson, Feb 20, 2004, in forum: Java
    Replies:
    3
    Views:
    331
    Matt Parker
    Feb 21, 2004
  3. Steve
    Replies:
    5
    Views:
    42,651
    Steve
    May 17, 2004
  4. Tintin92
    Replies:
    1
    Views:
    1,673
    Andrew Thompson
    Feb 14, 2007
  5. Haircuts Are Important
    Replies:
    3
    Views:
    299
    Haircuts Are Important
    Jun 4, 2013
Loading...

Share This Page