Re: 請問FlowLayout
※ 引述《NightPrince.bbs@ptt.cc (shooting star)》之銘言:
> ※ 引述《Maxmaman.bbs@bbs.wretch.cc (混亂中...)》之銘言:
> : 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海
討論串 (同標題文章)
完整討論串 (本文為第 3 之 3 篇):
java 近期熱門文章
PTT數位生活區 即時熱門文章