Re: 請問FlowLayout

看板java作者時間19年前 (2006/05/27 10:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/3 (看更多)
※ 引述《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
文章代碼(AID): #14TxBW00 (java)
文章代碼(AID): #14TxBW00 (java)