🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.gui
Article #52

Re: JTable & JScrollPane

#52
From: Dirk Ludwig
Date: Mon, 13 Sep 1999 00:00
37 lines
2434 bytes

Raf Lenaerts wrote:

> > > I have written a MyTable (extending JTable) with MyTableModel and
> > > MyTreeCellRenderer. The data that gets displayed is correct, but I am
> > > having troubles with the displaying of the data. All columns have a
> > > fixed width (I don't know why) and don't adjust to the width of my
> > > table. Either their is some space after the last column, or the last
> > > column does not get displayed.
> > > If I put the MyTable in a JScrollPane then there are never any
> > > scrollbars.
> >
> > Check for the scrollBarPolicies of the ScrollPane.
> > Set them to as_needed or as_always.
> > Then check the weight and autoscrolls settings for the cells.
> > Check the insets and internal padding settings for the cells also.
> > And set fixedWidth to false it there is such property.
> >
> The scrollbars were set as_needed.
> And I don't see how I have access to the cells. I only have a TableModel for
> MyTable. Do you mean yhay I should use a TableCellRenderer?
>
> I should say that if I change the width of one column, then all other
> collumns change their width and the table is displayed correctly. But I want
> it displayed correctly from the first moment.
>
> Raf

Maybe you have set the preferredSize of your table columns. When repainting a
JTable, Java always respects the preferredSize of a column. The fact that there
are
noScrollbars may be because of the JTable's autoResizeMode. Scrollbars are only
visible if the autoResizeMode was set to JTable.AUTO_RESIZE_OFF.

Regards,
   Dirk
Technical Details
Message-ID: <37DD045A.8FF850C4@iese.fhg.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7r5lih$9n7$1@news3.Belgium.EU.net> <7r5q79$f99$1@nnrp1.deja.com> <7r7lng$dfj$1@news3.Belgium.EU.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,27c1ee62fab07e84
X-Google-Attributes: gid111d45,public
X-Google-Thread: 10fd6d,27c1ee62fab07e84
X-Google-Attributes: gid10fd6d,public
From: Dirk Ludwig <ludwig@iese.fhg.de>
Subject: Re: JTable & JScrollPane
Date: 1999/09/13
Message-ID: <37DD045A.8FF850C4@iese.fhg.de>
X-Deja-AN: 524466965
Content-Transfer-Encoding: 7bit
References: <7r5lih$9n7$1@news3.Belgium.EU.net> <7r5q79$f99$1@nnrp1.deja.com> <7r7lng$dfj$1@news3.Belgium.EU.net>
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: postmaster.iese.fhg.de
X-Trace: mojanda.iese.fhg.de 937231455 23312 153.96.133.66 (13 Sep 1999 14:04:15 GMT)
Organization: Fraunhofer Gesellschaft Institut IESE
Mime-Version: 1.0
NNTP-Posting-Date: 13 Sep 1999 14:04:15 GMT
Newsgroups: comp.lang.java.gui,borland.public.jbuilder.java.swing