[5349] in java-interest
Re: GridBagLayout, and other layout problems.
daemon@ATHENA.MIT.EDU (James Gellman)
Tue Feb 6 11:58:45 1996
Date: Thu, 01 Feb 1996 11:55:11 -0600
From: James Gellman <gellman@cstar.ac.com>
To: java-interest@java.sun.com
James --
I've had the same problem and managed to get around it by setting the internal pad
GridBagConstraint (ipadx,ipady) whenever I use a subclass of Canvas. The problem
seems to be that Canvases are drawn in areas of size (0,0).
I'll bet you could also override minimumSize() or preferredSize() in your Canvas
subclass to get the same result.
James Waldrop <sulam@construct.net> wrote:
>
> Ok, I can't wait for a decent Layout manager tutorial. I'm trying to
> use GridBagLayout, and having quite a few problems.
>
> The general thing I want to see is:
> _______________________________
> | |
> | A |
> |_______________________________|
> _______________________________
> | |
> | B |
> |_______________________________|
> _______________________________
> |______________C________________|
>
> Where:
>
> A: is a subclass of Panel which contains a subclass of Canvas that an
> image is drawn onto.
>
> B: is a Panel which contains a TextArea.
>
> C: is a Panel which contains a TextField.
>
> Here's my code so far, please note the comments:
>
> public void init() {
>
> GridBagLayout gridBag = new GridBagLayout();
> GridBagConstraints c = new GridBagConstraints();
> c.fill = GridBagConstraints.BOTH;
>
> // setLayout(new FlowLayout()); // default, doesn't show A ??
> // setLayout(gridBag); // I can't make it show component A
> // setLayout(new BorderLayout()); // Also doesn't show component A
> setLayout(new GridLayout(3, 0)); // This works, but isn't what I want
> // C is much too large...
[deleted]
> I've tried explicitly setting gridx and gridy, played with weight, and
> of course used gridheight and gridwidth, all to no effect.
>
> Any advice?
>
> James
>
> - --
> James Waldrop / Technical Director
> sulam@construct.net / Construct Internet Design
> sulam@well.com / http://www.construct.net
>
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com