0

如何才能产生滚动条

asked 2009-09-22 10:20:19 +0800

cmd gravatar image cmd
69 1

updated 2009-09-22 10:20:59 +0800

<zk>
<zscript><![CDATA[
String[] data = new String[150];
for(int j=0; j< data.length; ++j) {
data = "option "+j;
}
ListModel strset = new SimpleListModel(data);
]]>
</zscript>
<listbox id="list" model="${strset}" width="200px" height="100%">
<listhead>
<listheader label="Load on Demend" sort="auto"/>
</listhead>
</listbox>
</zk>

对于上述代码,想要做到listbox自动填充满屏(为了适应不同分辨率),但是listbox中条目很多,只是出现了一部分,却不出纵向滚动栏??怎么办??
如果设定listbox 固定height,滚动栏会出现但是又不适应分辨率

delete flag offensive retag edit

2 Replies

Sort by » oldest newest

answered 2009-09-28 07:31:45 +0800

tabsuny gravatar image tabsuny
102

updated 2009-09-28 08:39:30 +0800

Hi cmd,

楼上的我还没有试,先说下我的。

我也遇到过这样的问题,我把布局排好后,按控件属性 height width 的百分比设置控件的位置和大小,纵向的滚动条并没有出现,
不知道ZK 布局里的百分比的参照依据是谁。

我是通过Java 获得屏幕的分辨率,然后根据获得的height width 去设置其他控件的百分比位置和大小。
下面的代码可能会对你有些帮助吧。
<window border="normal" height="100%">
<!-- apply="com.awent.logevent.AgentLogContro" -->
<paging id="userPaging"/>
<listbox id="dataListbox" width="100%">
<zscript><![CDATA[
{
//2009.09.25 for full screen
import java.awt.*;
int height=0;
double tempheight;
String strheight;

height=Toolkit.getDefaultToolkit().getScreenSize().height;
tempheight = height * 0.87;
strheight = Double.toString(tempheight);
strheight = strheight + "px";
dataListbox.setHeight(strheight);

//end 2009.09.25 for full screen
}
]]>
</zscript>
</listbox>
</window>

link publish delete flag offensive edit

answered 2009-09-23 01:08:33 +0800

adam4891288 gravatar image adam4891288
657 1 5

用个hbox括起来就行了

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-09-22 10:20:19 +0800

Seen: 649 times

Last updated: Sep 28 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More