如何刷新lwuit表单?
我正在从事一个项目,其中用户填写调查问卷,然后将答案提交到服务器。为简单起见,我只在每个屏幕上保留两个问题,单击下一个命令后,用户会收到接下来的两个问题。我在这个项目中使用了lwuit框架。
为了减少内存需求,我创建了 form
、questLabel1
、ansCombo1
、questLabel2
和 ansCombo2
> 仅一次。它们的属性是根据当前帧(屏幕)设置的。 问题是,如果您在表单 2 中,向下滚动到最后一个选项,然后单击“下一个”按钮,因为您向下滚动,即使在下一个表单上,该表单也不会显示上部组件< /em>尝试了很多事情。创建表单的新实例可能有效,但出于明显的内存原因,我不想使用它,
还有其他解决方案吗?
提前致谢,
I am working in a project in which user fills a questionnaire and the answers are then submitted to the server. For simplicity I have just kept two questions per screen and after clicking on the next command the user gets next two questions. I have used lwuit framework in this project.
To reduce the memory requirements I create form
, questLabel1
, ansCombo1
,questLabel2
and ansCombo2
only once. and their properties are set as per the current frame (screen). The problem is if you are in form 2 and you scroll down to the last option and then you click the next button, since you scrolled down the form doesn't displays the upper components even on the next form tried so many thing. creating a new instance of the form may work but I don't want to use that, for obvious memory reasons,
Any other solution?
thanks in advance,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要使其滚动以使组件可见,请检查
Component
/Container
API javadocs。我在 lwuit 页面上看到这些建议了一些具有适合语义的方法 -scrollComponentToVisible
、scrollRectToVisible
。 “如果此容器可滚动,请确保组件在滚动中可见...”之类的东西To make it scroll so that component is visible, check
Component
/Container
API javadocs. I've seen at lwuit page these suggest some methods with semantics that fits -scrollComponentToVisible
,scrollRectToVisible
. "Makes sure the component is visible in the scroll if this container is scrollable..." stuff like that您尝试过
form.revalidate()
吗?因为当您修改容器层次结构并需要重做布局时,这很有用。更新:在下一个表单的第一个组件上使用
requestFocus();
。它自动聚焦于第一个(上部)组件。Have you tried
form.revalidate()
?. Because this is useful when you modify the container hierarchy and need to redo the layout.Update: Use
requestFocus();
on first component of next form. Its automatically focused on first (Upper) component.您可以使用 form.refreshTheme() 或 form.revalidate() 刷新表单。如果您对任何特定容器进行了更新,则也对容器执行相同的操作。
You can use form.refreshTheme() or form.revalidate() for refreshing your form. If you have made updates on any particular container then do the same for container as well.