Article View: borland.public.jbuilder.java.swing
Article #10925Re: Changing JTable's model
From: Gavster McRavster
Date: Tue, 27 Jul 1999 00:00
Date: Tue, 27 Jul 1999 00:00
37 lines
2062 bytes
2062 bytes
try calling .doLayout() on the parent container Redding Bacon <reddingbacon@msn.com> wrote in message news:7nf7rb$as6@forums.borland.com... > Hello JBuilder, > > I am having a problem with the display of a JTable when I change it's model > during run-time. When the applet is started the JTable appears in a > JScrollBar and it fills it from corner to corner, which is what I want. But > the model of the JTable must be changed at run-time. When I do this the new > model is displayed, but the table "re-shapes" itself and no longer fills the > entire JScrollPane. Here is the code that I am using: > > > table.setModel(collection); > > scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS) > ; > scrollPane.setViewportBorder(BorderFactory.createLoweredBevelBorder()); > scrollPane.setBorder(BorderFactory.createLoweredBevelBorder()); > scrollPane.getViewport().add(subTable, null); > > The code above is used to initialize the JTable. It seems to work fine. > When I need to change its model I use the same code as above and that seems > to works as well, with one exception. The JTable doesn't fill the entire > JScrollPane as it did at first. I have tried several different variations > of the code listed above and have searched Sun's web site but have come up > empty handed. > >
Technical Details
Message-ID:
<933062867.27393.0.nnrp-01.c1c3e175@news.demon.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7nf7rb$as6@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,1d2879f132046deb X-Google-Attributes: gid111d45,public From: "Gavster McRavster" <gavinc@demon.net> Subject: Re: Changing JTable's model Date: 1999/07/27 Message-ID: <933062867.27393.0.nnrp-01.c1c3e175@news.demon.co.uk> X-Deja-AN: 505699661 X-NNTP-Posting-Host: gavinc.eng.demon.net:193.195.225.117 References: <7nf7rb$as6@forums.borland.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Complaints-To: abuse@demon.net X-Trace: news.demon.co.uk 933062867 nnrp-01:27393 NO-IDENT gavinc.eng.demon.net:193.195.225.117 X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing