Re: [問題] java layout/Tab
※ 引述《PsMonkey (痞子軍團團長)》之銘言:
: ※ 引述《RZAddict (鴆羅)》之銘言:
: : 已經爬文了
: : 我現在用的是Gridbaglayout
: : layout部分設定程式如下
: : constraints.weightx = 1;
: : constraints.weighty = 1;
: : constraints.fill = GridBagConstraints.BOTH;
: : addComponent( panelForOptions , 0 , 0 , 2 , 1 );
: : //另外自訂function設定座標+width+height
: 你的 addComponent 是哪來的?
: (我在 Gridbaglayout 找不到這個 method?)
: 不過這好像不是很重要 XD
addComponent是我自訂的function
0 , 0是座標
2 , 1是橫的兩格 直的一格
補上addComponent的code(從課本抄下來的)
private void addComponent( Component component ,
int row , int column ,
int width , int height ){
constraints.gridy = column;
constraints.gridx = row;
constraints.gridwidth = width;
constraints.gridheight = height;
layout.setConstraints( component , constraints );
add( component );
}
: : 可是他長成這樣
: : http://ppt.cc/Fgh8
: : 我希望她的tab是平行的
: : 不曉得要怎麼用?
: : 沒用layout以前是平行的
: ^^^^^^^^^^^^^^^^^^^^^^
: : 可是不會隨視窗大小改變tab部分的大小
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: 某種程度,你(可能)已經自問自答了...
: 你的 tab 因為空間不夠,所以只好疊在一起
: (謎之聲:我們也不願意阿...)
: 至於要怎麼滿足你的實際需求...
: 就請你慢慢盤算了
: 這不是一兩句話可以解決的事情 Orz
這看起來不是從0,0開始放物件阿QQ
如果是從0,0開始放不是應該在左邊一點嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.140.175
※ 編輯: RZAddict 來自: 140.113.140.175 (05/29 12:19)
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):