作者RZAddict (鸩罗)
看板java
标题Re: [问题] java layout/Tab
时间Tue May 29 12:17:50 2012
※ 引述《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)