🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: cannot set column width of table inside scrollpane

#11615
From: jsr1
Date: Wed, 28 Apr 1999 00:00
36 lines
2045 bytes
jsr1 wrote:
> 
> If I have a jdbTable with TableHeader on an applet window I can set
> column properties using
> 
>       tabcolmod2 = jdbTable2.getColumnModel();
>       tabcolmod2.getColumn(0).setHeaderValue("Code 4");
>       tabcolmod2.getColumn(1).setWidth(30);
>       tabcolmod2.getColumn(1).setHeaderValue("Title 4");
>       tabcolmod2.getColumn(1).setWidth(200);
> 
> but if they are inside a JScrollPane, set up with
> 
>     jScrollPane1 = jdbTable1.createScrollPaneForTable(jdbTable1);
> 
> and apply the code
> 
>       tabcolmod1 = jdbTable1.getColumnModel();
>       tabcolmod1.getColumn(0).setHeaderValue("Code 5");
>       tabcolmod1.getColumn(1).setWidth(30);
>       tabcolmod1.getColumn(1).setHeaderValue("Title 5");
>       tabcolmod1.getColumn(1).setWidth(200);
> 
> then the column heading text appears as I wish, but the width settings
> are ignored.

Another posting and reply about JTable had a reference to
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
which shows how to use setPreferredWidth rather than setWidth, which
works,
but is NOT documented (at least in the documentaion I have).

John S Robinson                              Tel:   +44-1904-433833
University of York Computing Service         Fax:   +44-1904-433740
Heslington, YORK.  YO10 5DD                  email: jsr1@york.ac.uk
http://www.york.ac.uk/~jsr1  -  but I wouldn't bother if I were you
Technical Details
Message-ID: <3726C961.5F41DF9B@york.ac.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3725D300.694B124F@york.ac.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,5e93a15f0ec83a3d
X-Google-Attributes: gid111d45,public
From: jsr1 <jsr1@york.ac.uk>
Subject: Re: cannot set column width of table inside scrollpane
Date: 1999/04/28
Message-ID: <3726C961.5F41DF9B@york.ac.uk>
X-Deja-AN: 471806432
Content-Transfer-Encoding: 7bit
References: <3725D300.694B124F@york.ac.uk>
To: jsr1 <jsr1@york.ac.uk>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing