A better looking JTable

Discussion in 'Java' started by Rob W, Sep 15, 2004.

  1. Rob W

    Rob W Guest

    I want to create a JTable that emulates the appearance of native tables
    on Windows and OSX. In particular, if the panel that a table is in is
    taller than the size of the table (due to the table only having a few
    rows), I want the extra space in the table to be filled with empty
    cells, so that the table fills the whole panel.

    This behaviour is present in most native apps I've seen that use tables.
    A good example is the iTunes songs list.

    My specific scenario is that I have a table which may contain only 1
    row, or may contain as many as 50 (typically it contains 2 or 3 rows).x

    I want to display this table in a pane that is resizable.

    This means that the table may have a lot of extra veritcal space,
    relative to the rows being displayed. I want it to fill the unused,
    lower part of the pane with empty cells as the pane is made larger (and
    when it is first drawn).

    Is there a simple way to do this, or do I need to create a custom JTable
    class to paint the table as described?

    Any suggestions will be much appreciated.

    Rob
     
    Rob W, Sep 15, 2004
    #1
    1. Advertising

  2. Rob W

    Paul Lutus Guest

    Rob W wrote:

    > I want to create a JTable that emulates the appearance of native tables
    > on Windows and OSX. In particular, if the panel that a table is in is
    > taller than the size of the table (due to the table only having a few
    > rows), I want the extra space in the table to be filled with empty
    > cells, so that the table fills the whole panel.
    >
    > This behaviour is present in most native apps I've seen that use tables.
    > A good example is the iTunes songs list.
    >
    > My specific scenario is that I have a table which may contain only 1
    > row, or may contain as many as 50 (typically it contains 2 or 3 rows).x
    >
    > I want to display this table in a pane that is resizable.
    >
    > This means that the table may have a lot of extra veritcal space,
    > relative to the rows being displayed. I want it to fill the unused,
    > lower part of the pane with empty cells as the pane is made larger (and
    > when it is first drawn).
    >
    > Is there a simple way to do this, or do I need to create a custom JTable
    > class to paint the table as described?
    >
    > Any suggestions will be much appreciated.


    Add empty rows to your table. Create a class that fills in the JTable to the
    degree necessary to meet your requirement without actually creating
    meaningless data in the original data set.

    --
    Paul Lutus
    http://www.arachnoid.com
     
    Paul Lutus, Sep 15, 2004
    #2
    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,536
    manusa
    Apr 12, 2007
  2. Tintin92
    Replies:
    1
    Views:
    1,806
    Andrew Thompson
    Feb 14, 2007
  3. Peter Bencsik
    Replies:
    2
    Views:
    878
  4. Andrew Thompson
    Replies:
    8
    Views:
    163
    Premshree Pillai
    Jun 7, 2005
  5. Haircuts Are Important
    Replies:
    3
    Views:
    412
    Haircuts Are Important
    Jun 4, 2013
Loading...

Share This Page