[3378] in java-interest

home help back first fref pref prev next nref lref last post

Re: reshape & LayoutManager confusion

daemon@ATHENA.MIT.EDU (Ed Anuff)
Thu Nov 9 22:01:11 1995

Date: Thu, 9 Nov 1995 15:43:18 -0800
To: java-interest@java.sun.com
From: edanuff@protagonist.com (Ed Anuff)

This will happen if you first size the component and then add() it to the
container.  If you add the component first and then size it, it works fine.
Also, setting the layout to null appears to work correctly now, so that
you no longer need to create an empty layout subclass to do absolute
positioning.

Try something like:

        setLayout(null);
        TestCanvas theCanvas = new TestCanvas();
        add(theCanvas);
        theCanvas.reshape(10, 20, 100, 50);

Where TestCanvas is a Canvas subclass.  The canvas should be positioned and
sized correctly.

Ed

>Is this on Windows 95? I think we recently fixed a bug that was
>resetting panels to 100x100.
>
>--sami
>
>|From daemon@java Wed Nov  8 19:36 PST 1995
>|Mime-Version: 1.0
>|Date: Wed, 8 Nov 1995 19:06:09 -0800
>|To: java-interest@java
>|From: William Cook <william@luma.com>
>|Subject: reshape & LayoutManager confusion
>|X-Info: To unsubscribe, send 'unsubscribe' to
>java-interest-request@java.sun.com
>|
>|My initial experience with the Beta API was good, but now I am stumped.
>|
>|I am trying to write a simple LayoutManager. Basically, I want to prevent
>|the normal "constraint-based" layout and just put things exactly where
>|I want them. So I make a class AbsoluteLayout which simply ignores
>|the request to layoutContainer; it assumes that the container parts are
>already
>|set up properly because nothing ever changes position.
>|
>|I then create a Panel set its layout to a new AbsoluteLayout. I then create
>|a bunch of different things (mostly Panels with FlowLayouts), set their
>|position to an absolute location using "reshape" and then wait for
>|everything to be refreshed.
>|
>|Somehow something resets all my Panels to have bounds (0, 0, 100, 100).



Ed Anuff
Protagonist Interactive
edanuff@protagonist.com
http://www.protagonist.com/


-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post