JTable column headers at the bottom?  
Author Message
SM





PostPosted: 2004-11-20 11:22:00 Top

java-programmer, JTable column headers at the bottom? Is there any way to get a JTable to display its column headers along the
bottom of the table rather than the top?

Thanks,

Sandeep
 
Babu Kalakrishnan





PostPosted: 2004-11-20 14:08:00 Top

java-programmer >> JTable column headers at the bottom? SM wrote:
> Is there any way to get a JTable to display its column headers along the
> bottom of the table rather than the top?
>

Yes - you can do it by adding the JTable and its TableHeader into
another JPanel with a BorderLayout, with constraints of CENTER and SOUTH
respectively.

Note that if you need the JTable to be inside a JScrollPane, you should
use a custom JTable whose "configureEnclosingScrollPane()" is overridden
to do nothing. (And place the JScrollPane as the CENTER component of
containing panel instead of the JTable). This is required because this
method would otherwise add the TableHeader of the Table as the RowHeader
for the JScrollPane.

BK
 
SM





PostPosted: 2004-11-21 1:15:00 Top

java-programmer >> JTable column headers at the bottom? In article <email***@***.com>,
Babu Kalakrishnan <email***@***.com> wrote:

> SM wrote:
> > Is there any way to get a JTable to display its column headers along the
> > bottom of the table rather than the top?
> >
>
> Yes - you can do it by adding the JTable and its TableHeader into
> another JPanel with a BorderLayout, with constraints of CENTER and SOUTH
> respectively.
>
> Note that if you need the JTable to be inside a JScrollPane, you should
> use a custom JTable whose "configureEnclosingScrollPane()" is overridden
> to do nothing. (And place the JScrollPane as the CENTER component of
> containing panel instead of the JTable). This is required because this
> method would otherwise add the TableHeader of the Table as the RowHeader
> for the JScrollPane.
>
> BK

Thanks for the reply! I'll give this approach a try. Like with so many
things in Swing, just about anything is possible if you know how to
manipulate the parent/child relationships and override appropriate
methods.

Thanks,

Sandeep