Search code examples
java-melwuit

How to get screen height in LWUIT out of height reserved for MenuBar and 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 ?


Solution

  • 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()