Jtable add rows to top instead of bottom

Discussion in 'Java' started by andrina.luczon@gmail.com, Jun 28, 2006.

  1. Guest

    I'm creating an error/warning message table. Every time an error or
    warning is generated, the row count increases by one and the value of
    the newly added row value is set to the message.

    However, when the new row is added, it is added to the bottom of the
    list. The user is not aware that a new message is added unless they
    scroll down to the bottom of the table.

    Is there a way to add new rows to the top of the table (without doing
    tons of shifting)

    Or is there a way to set the focus to bottom of the table, so that if
    more rows are added, the scroll will automatically scroll down to the
    most recently added row?

    Hope that makes sense.... any help is appreciated.
     
    , Jun 28, 2006
    #1
    1. Advertising

  2. > I'm creating an error/warning message table. Every time an error or
    > warning is generated, the row count increases by one and the value of
    > the newly added row value is set to the message.
    >
    > However, when the new row is added, it is added to the bottom of the
    > list. The user is not aware that a new message is added unless they
    > scroll down to the bottom of the table.


    DefaultTableModel#insertRow(int row, Object [] rowdata);

    Andrey

    --
    http://uio.imagero.com Unified I/O for Java
    http://reader.imagero.com Java image reader
    http://jgui.imagero.com Java GUI components and utilities
     
    Andrey Kuznetsov, Jun 28, 2006
    #2
    1. Advertising

  3. Lionel Guest

    wrote:
    > I'm creating an error/warning message table. Every time an error or
    > warning is generated, the row count increases by one and the value of
    > the newly added row value is set to the message.
    >
    > However, when the new row is added, it is added to the bottom of the
    > list. The user is not aware that a new message is added unless they
    > scroll down to the bottom of the table.
    >
    > Is there a way to add new rows to the top of the table (without doing
    > tons of shifting)
    >
    > Or is there a way to set the focus to bottom of the table, so that if
    > more rows are added, the scroll will automatically scroll down to the
    > most recently added row?
    >
    > Hope that makes sense.... any help is appreciated.
    >


    If you have some sensible order then you might consider looking at
    extending AbstractTableModel. It makes life much easier.

    Lionel.
     
    Lionel, Jun 28, 2006
    #3
    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. Arjen Hoekstra
    Replies:
    0
    Views:
    576
    Arjen Hoekstra
    Aug 2, 2005
  2. H.MuthuKumaraRajan
    Replies:
    3
    Views:
    464
    H.MuthuKumaraRajan
    Feb 4, 2004
  3. Dan
    Replies:
    1
    Views:
    8,392
    ainigma
    Apr 4, 2008
  4. Noozer
    Replies:
    1
    Views:
    7,202
    Carolyn Marenger
    Mar 13, 2006
  5. Cuthbert
    Replies:
    8
    Views:
    445
    Ancient_Hacker
    Sep 13, 2006
Loading...

Share This Page