如何刷新lwuit表单?

发布于 2024-11-26 13:25:09 字数 475 浏览 2 评论 0原文

我正在从事一个项目,其中用户填写调查问卷,然后将答案提交到服务器。为简单起见,我只在每个屏幕上保留两个问题,单击下一个命令后,用户会收到接下来的两个问题。我在这个项目中使用了lwuit框架。

为了减少内存需求,我创建了 formquestLabel1ansCombo1questLabel2ansCombo2 > 仅一次。它们的属性是根据当前帧(屏幕)设置的。 问题是,如果您在表单 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

败给现实 2024-12-03 13:25:09

要使其滚动以使组件可见,请检查 Component/Container API javadocs。我在 lwuit 页面上看到这些建议了一些具有适合语义的方法 - scrollComponentToVisiblescrollRectToVisible“如果此容器可滚动,请确保组件在滚动中可见...”之类的东西

  // above extracted from comment to an answer to make it more visible
  // for the case if some reader has similar problem

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

  // above extracted from comment to an answer to make it more visible
  // for the case if some reader has similar problem
友谊不毕业 2024-12-03 13:25:09

您尝试过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.

爱你不解释 2024-12-03 13:25:09

您可以使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文