[5372] in java-interest
RE: How do I specify rows/columns for GridBagLayout?
daemon@ATHENA.MIT.EDU (Groshe)
Tue Feb 6 22:27:55 1996
From: Groshe <gnicaj@iu.net>
To: "'Amy Fowler'" <Amy.Fowler@Eng.Sun.COM>,
"'gnicaj@iu.net'"
<gnicaj@iu.net>,
"'Cay Horstmann'" <horstman@jupiter.SJSU.EDU>,
"'java-interest@java.Eng.Sun.COM'" <java-interest@java.Eng.Sun.COM>,
"'java@java.Eng.Sun.COM'" <java@java.Eng.Sun.COM>,
"'john@insightnews.com'" <john@insightnews.com>
To: "'jug@jug.org'" <jug@jug.org>
Date: Tue, 6 Feb 1996 20:51:32 -0500
Jeff Marin and Cay Horstmann,
Thanks to both of you for helping me out with the GridBagLayou/Canvas =
problem. Both of your suggestions helped me out to get that image on =
the Grid. Here's what I added that caused a miracle to happen:
Added the following methods:
public Dimension minimumSize()=20
{
w =3D image.getWidth(this);
h =3D image.getHeight(this);
return new Dimension(w,h);
}
public Dimension preferredSize()=20
{
return minimumSize();
}
Also added the following to my constructor:
resize(this.preferredSize());
How interesting.
I'm still not sure I understand why I need to do this - but hey it =
works.
Thanks again
Groshe
----------
From: Cay Horstmann[SMTP:horstman@jupiter.SJSU.EDU]
Sent: Tuesday, February 06, 1996 12:59 PM
To: 'Amy Fowler'; 'gnicaj@iu.net'; 'java-interest@java.Eng.Sun.COM'; =
'java@java.Eng.Sun.COM'; 'john@insightnews.com'; 'jug@jug.org'
Subject: RE: How do I specify rows/columns for GridBagLayout?
And when you do that, be sure to specify a resize() in the=20
Canvas constructor. Otherwise, the size will be assumed zero and the GBL =
will lay out your zero size canvas with great enthusiasm.
Cay
horstman@cs.sjsu.edu
----------
From: Amy Fowler[SMTP:Amy.Fowler@Eng.Sun.COM]
Sent: Monday, February 05, 1996 12:23 PM
To: Amy.Fowler@Eng.Sun.COM; java-interest@java.Eng.Sun.COM; =
java@java.Eng.Sun.COM; john@insightnews.com; jug@jug.org; gnicaj@iu.net
Subject: RE: How do I specify rows/columns for GridBagLayout?
>>
>>Is it possible to use a GridBagLayout to draw Images?
>>When I draw an image I need to specify the coordinates, but the =
GridBagLayout=20
doesn't allow that - you just add it..
>>How can I get an Image on the GridBagLayout?
I would recommend creating a subclass of Canvas (ImageCanvas
or something) which knows how to render the image on the
canvas, and then just add the canvas to your GridBagLayout.
Regards,
Amy Moore-Fowler
Java Products Group
Sun Microsystems, Inc.
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com