🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #11394

Re: JTable: fixing first collumn while scrolling horizontally

#11394
From: Christian Kaufhold
Date: Mon, 07 Jun 1999 00:00
31 lines
1433 bytes
Peter Meulmeester <pmeulm@wirehub.nl> wrote:
> I need to build a gui where the fist collumn of a table moves along
> with the data when the user scolls vertically, but stays fixed, (and
> thus visible) when the user scrools horizontally. I can think of 2 ways
> of doing this?

Use the something like:

JTable table = new JTable(...);

JTable header = new JTable(...);

header.setSelectionModel(table.getSelectionModel());

Dimension maximumSize = new Dimension(40, 10000);

header.setMaximumSize(maximumSize);

JViewport viewport = new JViewport();
viewport.setView(header);
viewport.setPreferredSize(maximumSize);

JScrollPane pane = new JScrollPane(table);

pane.setRowHeader(viewport);

I haven't found yet a solution without hard-coding the width of the
header column.


Christian
Technical Details
Message-ID: <e70hj7.6r.ln@nandus.uni-bremen.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7jgcme$25mh$1@thor.wirehub.nl>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,c1563a844f181141
X-Google-Attributes: gid111d45,public
X-Google-Thread: 10fd6d,c1563a844f181141
X-Google-Attributes: gid10fd6d,public
From: Christian Kaufhold <chka@uni-bremen.de>
Subject: Re: JTable: fixing first collumn while scrolling horizontally
Date: 1999/06/07
Message-ID: <e70hj7.6r.ln@nandus.uni-bremen.de>
X-Deja-AN: 486769481
References: <7jgcme$25mh$1@thor.wirehub.nl>
Organization: Uni Bremen, ZfN
User-Agent: tin/pre-1.4-980618 (UNIX) (Linux/2.0.36 (i586))
Newsgroups: borland.public.jbuilder.java.swing,comp.lang.java.gui