🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JScrollpane and JTable

#12502
From: Matt Krevs
Date: Wed, 16 Dec 1998 00:00
15 lines
1020 bytes
Try this

JPanel panel = new JPanel();
panel.add(new JLabel("hello"));
scrollpane.getViewport().remove(table);
scrollpane.getViewport().removeNotify();
// remove this line scrollpane.getViewport().repaint();
scrollpane.getViewport().add(panel);
// add this line
validate();

Basically, when you add/remove things after a container has been displayed,
you need to call validate() for the container so it re lays out itself. My
rule of thumb is that I never call repaint(), paint() etc and I instead call
validate().
Technical Details
Message-ID: <756ktg$p3c11@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36769DA6.AFA81B38@spring.fr>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,13833af79de51367
X-Google-Attributes: gid111d45,public
From: "Matt Krevs" <mattkrevs@flex.com.au>
Subject: Re: JScrollpane and JTable
Date: 1998/12/16
Message-ID: <756ktg$p3c11@forums.borland.com>
X-Deja-AN: 422637705
References: <36769DA6.AFA81B38@spring.fr>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing