🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: cannot set column width of table inside scrollpane

#11517
From: Mark Kent
Date: Mon, 17 May 1999 00:00
70 lines
2850 bytes
This is a multi-part message in MIME format.
--------------53BC831E86028FBE813828FE
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Try using
jTable.setWidth() and
jTable.setPreferredSize( new Dimension( w, h ) );

I use JTables quite extensively.  I tried that nifty trick.  This works
for me.
I use this when I want to change the font size of the table just before
printing.

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.
>
> Any suggestions ?  Thanks!
>
> --
> 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

--------------53BC831E86028FBE813828FE
Content-Type: text/x-vcard; charset=us-ascii;
 name="markk.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Mark Kent
Content-Disposition: attachment;
 filename="markk.vcf"

begin:vcard 
n:Kent;Mark
tel;work:(401) 726-7937
x-mozilla-html:FALSE
org:MHRI;Information Services
adr:;;111 Brewster St.;Pawtucket;RI;02860;U.S.A.
version:2.1
email;internet:markk@mhri.org
note;quoted-printable:****************************=0D=0AHave a Disney Day=0D=0A****************************
x-mozilla-cpt:;31200
fn:Mark Kent
end:vcard

--------------53BC831E86028FBE813828FE--
Technical Details
Message-ID: <37406070.1BF93F61@mhri.org>
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: Mark Kent <markk@mhri.org>
Subject: Re: cannot set column width of table inside scrollpane
Date: 1999/05/17
Message-ID: <37406070.1BF93F61@mhri.org>
X-Deja-AN: 479084600
References: <3725D300.694B124F@york.ac.uk>
X-Accept-Language: en
Content-Type: multipart/mixed; boundary="------------53BC831E86028FBE813828FE"
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing