如何在 LWUIT 中获取为 MenuBar 和 TitleBar 保留的高度之外的屏幕高度?

发布于 2024-12-18 06:22:56 字数 205 浏览 0 评论 0原文

我想获取可以在其上绘制对象的屏幕的高度和宽度。它是除菜单栏(包含命令的页脚)和标题栏之外的空间。

提示:我知道 Display.getInstance().getDisplayHeight() 返回屏幕的高度,但这是针对全屏的。那么我至少如何知道 MenuBar 和 TitleBar 的高度来从这个高度中减去它们呢?

I want to get the height and width of the screen which I could draw objects on. It's the space which is other than the the MenuBar (the footer containing commands) and other than the TitleBar.

TIP: I know that Display.getInstance().getDisplayHeight() returns the height of the screen but this is for the full sceen. So how could I, at least, know the height of the MenuBar and TitleBar to substract them from this height ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

江湖正好 2024-12-25 06:22:56

我为有兴趣的人找到了答案:

获取TitleBar的高度:Form.getTitleComponent().getPreferredH()
获取AddressBar的高度:Form.getSoftButton(0).getParent().getPreferredH()

所以我的问题的答案是:

Display.getInstance().getDisplayHeight() 
        - form.getTitleComponent().getPreferredH() 
        - (getSoftbuttonCount() < 1) ? 0 : form.getSoftButton(0).getParent().getPreferredH()

I found the answer for those who are interested:

To get the height of TitleBar: Form.getTitleComponent().getPreferredH()
To get the height of AddressBar: Form.getSoftButton(0).getParent().getPreferredH()

So the answer of my question is:

Display.getInstance().getDisplayHeight() 
        - form.getTitleComponent().getPreferredH() 
        - (getSoftbuttonCount() < 1) ? 0 : form.getSoftButton(0).getParent().getPreferredH()
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文