1

I want to show a Dialog with the method signature show(int top, int bottom, int left, int right, boolean includeTitle)

I want to place this Dialog in the center of the screen. So I want to know the total number of pixels of the screen vertically and the total number of pixels of the screen horizontally.

How to achieve that ?

bharath
  • 14,283
  • 16
  • 57
  • 95
  • What is the need of pixels for whole screen? Once you give all four parameters same - top, bottom, left, right; it will display your dialog in center. eg. `dialog.show(20, 20, 20, 20, true);` Or if you want rectangle dialog box in center, you can call it like `dialog.show(10, 10, 20, 20, true);` – Mital Pritmani Jun 21 '11 at 13:59

1 Answers1

1

If you're looking for the methods that give you these dimensions in LWUIT then
you obtain a reference to the Display Display.getInstance()
then you can call getDisplayHeight() or getDisplayWidth();
but if you want to use MIDP classes you have to get a reference to the Display
by calling Display.getDisplay(Midlet instance) and then getting a reference to the
current Displayable getCurrent() and then you can call getWidth() or getHeight().

Ibrahim Najjar
  • 19,178
  • 4
  • 69
  • 95