Article View: cn.bbs.comp.lang.java
Article #20266Re: [��,����]Controlling Layout
From: campo
Date: Sun, 21 Dec 2003 12:05
Date: Sun, 21 Dec 2003 12:05
42 lines
2271 bytes
2271 bytes
setSize(*,*)��Panel֮��,��ôһ��Ӱ�춼û��:(
�ܷ���ҿ�������������:
public class WhiteBoard extends JFrame {
WhiteBoardControl boardControl;
....
private void init() {
boardControl = new WhiteBoardControl();
Container cp = getContentPane();
cp.add(BorderLayout.WEST, boardControl);
......
}
......
}
class WhiteBoardControl extends JPanel implements ItemListener {
public WhiteBoardControl() {
setSize(10,100); <<-----------��������,��������?
setLayout(new FlowLayout());
for(int i=1; i<=8; i++)
add(new JButton("Button"+i));
.......
}
.......
}
�� �� skyhit (Java & .Net) �Ĵ������ᵽ: ��
: һ���뷨��
: btn������JPanel�У���Panel�Ĵ�С
: �� ggoo (campo) �Ĵ������ᵽ: ��
: : _____________
: : |__1__|__2__|
: : |__3__|__4__|
: : |__5__|__6__|
: : ��Ҫ�����������е�2�а�ť,�����GridLayerout ��Button �Ĵ�С��������С��ı�
: : �����FlowLayout,��6��Button����ʾ��ͬһ��.
: >> .................<����ʡ��>............
--
[m[1;35m�� ��Դ:��Ʈ��ˮ�Ƽ� Freecity.dhs.org��[FROM: ggoo][m
Technical Details
Message-ID:
<49jH8E$9SL@Freecity.dhs.org>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!news-xfer2.atl.newshosting.com!167.206.3.103.MISMATCH!news3.optonline.net!ctu-peer!news.nctu.edu.tw!netnews.csie.nctu.edu.tw!maily.cic.tsinghua.edu.cn!news.ccie.net.cn!FreecityShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,GB X-Google-Thread: f6cb0,9fa9a522ca7a8dcb X-Google-Attributes: gidf6cb0,public X-Google-ArrivalTime: 2003-12-22 03:07:56 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!news-xfer2.atl.newshosting.com!167.206.3.103.MISMATCH!news3.optonline.net!ctu-peer!news.nctu.edu.tw!netnews.csie.nctu.edu.tw!maily.cic.tsinghua.edu.cn!news.ccie.net.cn!Freecity From: ggoo.bbs@Freecity.dhs.org (campo) Newsgroups: cn.bbs.comp.lang.java Subject: Re: [��,����]Controlling Layout Date: 21 Dec 2003 12:05:50 GMT Organization: Ʈ��ˮ�Ƽ� Message-ID: <49jH8E$9SL@Freecity.dhs.org> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 8bit X-Filename: Java/M.1072007822.A Lines: 42