🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Changing JTable's model

#10995
From: Redding Bacon
Date: Sun, 25 Jul 1999 00:00
24 lines
1630 bytes
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: <7nf7rb$as6@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,1d2879f132046deb,start
X-Google-Attributes: gid111d45,public
From: "Redding Bacon" <reddingbacon@msn.com>
Subject: Changing JTable's model
Date: 1999/07/25
Message-ID: <7nf7rb$as6@forums.borland.com>
X-Deja-AN: 505118660
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Organization: RMS
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.swing