🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Setting Column Widths in JTable

#12651
From: Vasudevan Srinivasan
Date: Mon, 07 Dec 1998 00:00
41 lines
1862 bytes
Try settin the minwidth also.
like
columns[i].setMinWidth(x);
columns[i].setWidth(x);

Vasu

Marc Maman wrote:

> Petr Srajer wrote:
>
> > Marc Maman wrote:
> >
> > > The following code works fine with the applet viewer and also with
> > > Netscape when run as an applet. However, it does not work with Sun's
> > > Java plug-in for Netscape. Any ideas?
> > >
> > >       final static String[] column_labels =
> > >       {
> > >         "COLUMNA", "COLUMNB", "COLUMNC", "COLUMND", "COLUMNE"
> > >       };
> > >       final static int[] column_widths =
> > >       {
> > >         70, 70, 420, 70, 70
> > >       };
> > >
> > >          for (int i=0; i<column_widths.length; i++)
> > >          {
> > >                  TableColumn column = jTable1.getColumn( column_labels[
> > > i ] );
> > >                  column.setWidth( column_widths[i] );
> > >          }
> >
> >     If you need help please specify more problem.(console listing , ...)
> >
> >             Petr.
>
> The console doesn't display any message. The problem is: the columns don't
> get sized appropriately (i.e. they all show with the same width) as opposed
> to when you run it with the applet viewer, where they all size
> proportionally.
Technical Details
Message-ID: <366C2778.E672E84D@netrisk.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3666AEBB.4B3B8D34@hypercon.com> <3667A4E3.7EABC162@ais.cz> <3667FB3D.F9103453@hypercon.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,7cd3722a73fee868
X-Google-Attributes: gid111d45,public
From: Vasudevan Srinivasan <vasudevan@netrisk.com>
Subject: Re: Setting Column Widths in JTable
Date: 1998/12/07
Message-ID: <366C2778.E672E84D@netrisk.com>
X-Deja-AN: 419723877
Content-Transfer-Encoding: 7bit
References: <3666AEBB.4B3B8D34@hypercon.com> <3667A4E3.7EABC162@ais.cz> <3667FB3D.F9103453@hypercon.com>
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing