Article View: borland.public.jbuilder.java.swing
Article #12854Re: Scrollbars & JTable
From: Paul Furbacher
Date: Mon, 26 Oct 1998 00:00
Date: Mon, 26 Oct 1998 00:00
28 lines
1624 bytes
1624 bytes
Papadomichelakis John wrote: > > Is it possible not to have horizontal scrollbars, instead of > autoresizing the width of each column on JTable object? > > I am using the JScrollPane class but it still at autoresizes the columns > to fit the screen. > > Playing with maximum/minimum size I manage to get some scrollbars. > However when I use them the JTable is not refreshed. > > Any ideas about this? The view you place in the viewport of the JScrollPane must implement the Scrollable interface. In particular, the method "getScrollableTracksViewportWidth()" should return true in your case. Next, this view should return a dimension from its "getPreferredSize()" method the width of which equals the JViewport.getExtentSize().width. The height will be determined by the number of rows * row height, as usual. While calculating the new preferred size, you would calculate the new column widths accordingly. I think that just about covers it. Paul Furbacher
Technical Details
Message-ID:
<3634F088.A42BDD6D@bilbo.bio.purdue.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<362FB162.1B88F10@freemail.gr>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,a98d457d401f491d X-Google-Attributes: gid111d45,public From: Paul Furbacher <pf@bilbo.bio.purdue.edu> Subject: Re: Scrollbars & JTable Date: 1998/10/26 Message-ID: <3634F088.A42BDD6D@bilbo.bio.purdue.edu> X-Deja-AN: 405328389 Content-Transfer-Encoding: 7bit References: <362FB162.1B88F10@freemail.gr> To: Papadomichelakis John <michelos@freemail.gr> Content-Type: text/plain; charset=us-ascii Organization: Biological Sciences, Purdue Univ. Mime-Version: 1.0 Reply-To: pf@bilbo.bio.purdue.edu Newsgroups: borland.public.jbuilder.java.swing