🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #17370

Ooops...never mind

#17370
From: William Yu
Date: Mon, 16 Nov 1998 00:00
30 lines
1779 bytes
William Yu wrote:

> Situation: the component can determine the font *after* it has been
> added to the container and then change the dimensions.  However, the
> container uses the initial dimensions to determine position and such.
> Since I doubt I can break apart the "add" routine, my guess would be to
> force the container's layout manager to re-run after the size has been
> set.  Anyone have any ideas?

Silly me.  I can't believe I not only missed this but let it go for 2
months.  My code looked like the following:

    public void addNotify() {
        setComponentSize();
        super.addNotify();
    }

But it's obvious why that code doesn't work.  Since I can't get the font
until after the component has been added to the container, the two commands
are in reverse sequence.  What was throwing me off was that doLayout() as
not working either.  What I also attempted was:

    public void doLayout() {
        setComponentSize();
        super.doLayout();
    }

My thinking this code would get the fontmetrics and set the component size
before the layout manager did its work.  But it's obvious (since the code
didn't work) this method is called after the layout manager does its work.
Technical Details
Message-ID: <364FEE02.2D662CF7@Bigfoot.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <364FE7A9.6FED5A53@Bigfoot.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,f9040747d36ce3e
X-Google-Attributes: gidf74b3,public
From: William Yu <William_Yu@Bigfoot.com>
Subject: Ooops...never mind
Date: 1998/11/16
Message-ID: <364FEE02.2D662CF7@Bigfoot.com>
X-Deja-AN: 412328127
Content-Transfer-Encoding: 7bit
References: <364FE7A9.6FED5A53@Bigfoot.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language