看板java
标 题Re: 请问FlowLayout
发信站无名小站 (Sat May 27 09:48:31 2006)
转信站ptt!ctu-reader!Spring!news.nctu!news.ntu!news.ee.ttu!netnews.csie.nctu
※ 引述《[email protected] (shooting star)》之铭言:
> ※ 引述《[email protected] (混乱中...)》之铭言:
> : FlowLayout是从左排到右,
> : 假设现在JPanel只有一个放在JFrame上面,
> : 要在JPanel上面放Button,
> : 想做出add一个JButton後直接换行再一个JButton的模子。
> : 但是,
> : 有什麽好方法可以控制Button换行?
> : (我不要加其他JPanel,而且希望JButton在JFrame展开後能放大)
> : 目前只知道如果JButton超过大小才会自己换行
> How about GridLayout ?
> sample code is following :
> JPanel panel = new JPanel();
> JButton button[] = new JButton[2];
> button[0] = new JButton("Hello World 1");
> button[1] = new JButton("Hello World 2");
> panel.setLayout(new GridLayout(0,1));
> panel.add(button[0]);
> panel.add(button[1]);
> You can read java api to comprehend GridLayout in detail.
> good luck
ya~
thanks a lot
I've known that before.
I think I should try more and read more java api.
--
有错请指正,THX
--
夫兵者不祥之器物或恶之故有道者不处君子居则贵左用兵则贵右兵者不祥之器非君子
之器不得已而用之恬淡为上胜而不美而美之者是乐杀人夫乐杀人者则不可得志於天下
矣吉事尚左凶事尚右偏将军居左上将军居右言以丧礼处之杀人之众以哀悲泣之战胜以
丧礼处之道常无名朴虽小天下莫能臣侯王若能守之万物将自宾天地相合以降甘露民莫
之令而自均始制有名名亦既有夫亦将知止知止可以 maxmaman.Dorm10.NCTU.edu.tw海