Skip to main content

Personal profile, java.awt.Frame issues

18 replies [Last post]
jldominguez
Offline
Joined: 2008-01-02
Points: 0

Hello, we are trying to run our GIS mobile application on phoneME. Congratulations for the job. We have found a strange variation in the behavior of the class java.awt.Frame. We have tested two different builds (with Davy's CABs) and, with exactly the same code and starting parameters, we get the difference you can see in this screenshot. The funny thing is that the newest version behaves worse than the previous. We are using a DELL Axim X51v pocket pc, which has a screen size of 480x640 pixels (192 DPI):

https://correo.prodevelop.es/descarga/mobile/frame_change.jpg

(you need to accept the authentication message. Let me know if you cannot see the image)

Could we please go back to the previous behavior? Also, the menu bar is not working properly. There is only a suspicious "MenuItem".

Regards,
Lucas

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Davy Preuveneers

phonemeadvanced@mobileandembedded.org wrote:
> Yes, the user can move and resize the java.awt.Frame, even if I said explicitly setResizable(false).
>
> In fact, the bevavior and look of the java.awt.Frame in phoneME is one of the main disadvantages when you compare it to IBM J9.
>
> In J9, awt controls look also austere, but the java.awt.Frame is perfectly integrated in the Windows system. The frame appears maximized without additional lines or margins along the borders, and the Frame's top bar does not interfere with the system's task bar. Of course the user cannot move or resize it, which does not make sense in a pocket pc.
> [Message sent by forum member 'jldominguez' (jldominguez)]
>
> http://forums.java.net/jive/thread.jspa?messageID=297111
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
> For additional commands, e-mail: advanced-help@phoneme.dev.java.net
>
I can confirm what jldominguez said. It is possible to drag and resize
a frame. It depends on how the native WinCE window is created.
The problem is that you cannot change the setting anymore afterwards (or
it is not really straightforward to get this implemented right)

The current approach differs with J9 in that AWT frames in J9 are always
full screen. It is quite easy to emulate this behavior, I just
have to override the frame size set by the user to the size of the
display and in that case I can really use native functions to put the
frame into fullscreen instead of just resizing the window. Is that the
behavior that is most preferred? I don't know how this will
work out with small Dialog Frames.

Davy

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

jldominguez
Offline
Joined: 2008-01-02
Points: 0

Hello, Davy. Thank you very much for that response. I think the most sensible behavior in a pocket pc is having full-screen frames (java.awt.Frame), and if the developer wants a non-full-screen window, he can use a java.awt.Dialog (that's what we are doing with J9 and works fine)

Regards,

Hinkmond Wong

phonemeadvanced@mobileandembedded.org wrote:
> Hello, Davy. Thank you very much for that response. I think the most sensible behavior in a pocket pc is having full-screen frames (java.awt.Frame), and if the developer wants a non-full-screen window, he can use a java.awt.Dialog (that's what we are doing with J9 and works fine)
>

Sounds reasonable as long as you can switch back and forth with other
Windows Mobile native applications and if floating Dialog Boxes work OK
and will be smaller than the app window.

Otherwise, you might want this to be supported only when an optional
build flag is set.

Thanks,

Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

jldominguez
Offline
Joined: 2008-01-02
Points: 0

Yes, with java.awt.Dialog we can show (both with J9 and phoneME) windows with arbitrary size and position. In their constructor, you pass the parent (java.awt.Frame) as a parameter, so when the frame is minimized (this works with J9, not sure about phoneME) the floating dialog is hidden too.

jldominguez
Offline
Joined: 2008-01-02
Points: 0

Thank you for that b86 :)
Lucas

Davy Preuveneers

I made some changes to the code that handles the position of the
java.awt.Frame. Instead of using a fixed height of 26 pixels, I now
explicitly ask the WinCE taskbar what its height is. Hopefully it fixes the
wrong offset on a 640x480 screen. Also, instead of always forcing the window
below the taskbar, I first check if the window height is small enough to put
the window below the taskbar. If so, I modify the y-offset to be at least
higher than the height of the taskbar. If not (e.g. for a full screen window
size), I do not modify the y-offset. I do this because there are some drawing
issues on older WinCE editions where the top bar of the awt frame is
partially covered by the taskbar (so you can't drag the awt frame). Also,
even if you can move it with your stylus pen, you cannot put it on top of the
WinCE taskbar anyway.

A lot more tricker was the suspicous "MenuItem" menu. The problem is that you
cannot modify a menu that easily in WinCE at runtime. For a regular native
application, you normally specify a menu in a resource file (a .rc file),
compile it, load the menu in your native code and voila. There is no other
way to set a menu. That is why the JVM loads a dummy "MenuItem" menu from a
resource file. For a Java application with its own menu, we need to change
the dummy menu at runtime, and the only thing we can do is add the Java menu
as a submenu. The old code sent a message to the menu bar to get the
predefined "MenuItem" entry and replace that one with the one defined by the
Java application. In WM5 that particular message is not supported (always
returning NULL), so the menu is not updated. I found another way to insert a
submenu, but due to the workaround the menu looks a bit different on WM5
compared to a WM2003 device. Another issue was that the handles of the real
and registered menubars didn't match (so nothing happened when you clicked on
a menu item). After messing around with various window and menu handles I
made a workaround that works on the emulator and on my PDA, but I am not
quite sure how it behaves on the various types and versions of Windows Mobile
devices (Smartphone/PocketPC). I have put some binaries on my website for you
to play with:

http://www.cs.kuleuven.be/~davy/phoneme/downloads.htm

Regards,
Davy

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

Davy Preuveneers

On Thursday 31 July 2008, phonemeadvanced@mobileandembedded.org wrote:
> Hello, we are trying to run our GIS mobile application on phoneME.
> Congratulations for the job. We have found a strange variation in the
> behavior of the class java.awt.Frame. We have tested two different builds
> (with Davy's CABs) and, with exactly the same code and starting parameters,
> we get the difference you can see in this screenshot. The funny thing is
> that the newest version behaves worse than the previous. We are using a
> DELL Axim X51v pocket pc, which has a screen size of 480x640 pixels (192
> DPI):
>
> https://correo.prodevelop.es/descarga/mobile/frame_change.jpg

I could see the image.

Yes, I have changed a few things in the PPC peer for the awt frame. The
problem previously was that a simple hello world window when launched
partially covered the top bar (the one with the "start" button). This
behaviour was inconsistent with other applications, so I wanted to make sure
that the position of the frame was always below the top bar.

I notice two things in your screenshot:
-the first image seems correct indeed. Do you run your application fullscreen?
-in the second image, the window starts halfway the top bar. It appears that
the height of the top bar depends on the resolution. I assumed it was always
26 pixels, but perhaps this is only on 240x320 and 52 for your 480x640 model.

I'll see what I can do about it.

> (you need to accept the authentication message. Let me know if you cannot
> see the image)
>
> Could we please go back to the previous behavior? Also, the menu bar is not
> working properly. There is only a suspicious "MenuItem".

Yep, that is the problem I am also seeing with my builds. Try and see if you
could run your application on a Windows Mobile 2003 emulator. I bet the menu
will work with the same binaries (well you would have to use those for WM2003
because the ones for WM5 and higher won't run on WM2003). The binaries for
2003 do work on WM5 and higher though.

Regards,
Davy

--
Davy Preuveneers
K.U.Leuven - http://www.kuleuven.be
Department of Computer Science - http://www.cs.kuleuven.be
DistriNet - http://www.cs.kuleuven.be/~distrinet
Celestijnenlaan 200A, B-3001 Heverlee (Leuven), Belgium
Room: 02.152
Phone: (+32) (0)16 327853
E-Mail: Davy.Preuveneers@cs.kuleuven.be
Web: http://www.cs.kuleuven.be/~davy
[signature.asc]

jldominguez
Offline
Joined: 2008-01-02
Points: 0

Hello, thanks for your response.

Yes, we would like to have a full screen frame. The first screenshot is the one we like. We prefer not no have two top bars (system + application).

I guess you already know, but the method:

Toolkit.getDefaultToolkit().getScreenResolution();

tells the correct DPI, so you can assume that the top bar height is (DPI * 26 / 96) pixels and I think it will be correct in most cases.

You mean there is a way (with the most recent build) to place the frame on top of the system top bar (as in first screenshot) and also a way to put the frame below it (so we would have two bars)?

ok, I'll try WM2003. Our application runs on WM2003, WM5 and WM6 with the same code. Obviously WM5 is our priority right now.

Thanks for that great job,
Lucas

davyp
Offline
Joined: 2007-01-03
Points: 0

[Repost: My previous email to the pMEA list doesn't appear on the forum]

I made some changes to the code that handles the position of the
java.awt.Frame. Instead of using a fixed height of 26 pixels, I now explicitly
ask the WinCE taskbar what its height is. Hopefully it fixes the wrong offset
on a 640x480 screen. Also, instead of always forcing the window below the
taskbar, I first check if the window height is small enough to put the window
below the taskbar. If so, I modify the y-offset to be at least higher than the
height of the taskbar. If not (e.g. for a full screen window size), I do not
modify the y-offset. I do this because there are some drawing issues on
older WinCE editions where the top bar of the awt frame is partially covered
by the taskbar (so you can't drag the awt frame). Also, even if you can
move it with your stylus pen, you cannot put it on top of the WinCE taskbar
anyway.

A lot more tricker was the suspicous "MenuItem" menu. The problem is that
you cannot modify a menu that easily in WinCE at runtime. For a regular
native application, you normally specify a menu in a resource file (a .rc
file), compile it, load the menu in your native code and voila. There is no
other way to set a menu. That is why the JVM loads a dummy "MenuItem"
menu from a resource file. For a Java application with its own menu, we
need to change the dummy menu at runtime, and the only thing we can do
is add the Java menu as a submenu. The old code sent a message to the
menu bar to get the predefined "MenuItem" entry and replace that one with
the one defined by the Java application. In WM5 that particular message is
not supported (always returning NULL), so the menu is not updated. I found
another way to insert a submenu, but due to the workaround the menu looks
a bit different on WM5 compared to a WM2003 device. Another issue was
that the handles of the real and registered menubars didn't match (so
nothing happened when you clicked on a menu item). After messing around
with various window and menu handles I made a workaround that works on
the emulator and on my PDA, but I am not quite sure how it behaves on the
various types and versions of Windows Mobile devices (Smartphone/PocketPC).
I have put some binaries on my website for you to play with:

http://www.cs.kuleuven.be/~davy/phoneme/downloads.htm

Regards,
Davy

Hinkmond Wong

Davy P. wrote:
> [Repost: My previous email to the pMEA list doesn't appear on the forum]
>
> I made some changes to the code that handles the position of the
> java.awt.Frame. Instead of using a fixed height of 26 pixels, I now explicitly
> ask the WinCE taskbar what its height is.
...
> In WM5 that particular message is
> not supported (always returning NULL), so the menu is not updated. I found
> another way to insert a submenu, but due to the workaround the menu looks
> a bit different on WM5 compared to a WM2003 device. Another issue was
> that the handles of the real and registered menubars didn't match (so
> nothing happened when you clicked on a menu item). After messing around
> with various window and menu handles I made a workaround that works on
> the emulator and on my PDA, but I am not quite sure how it behaves on the
> various types and versions of Windows Mobile devices (Smartphone/PocketPC).
> I have put some binaries on my website for you to play with:
>
> http://www.cs.kuleuven.be/~davy/phoneme/downloads.htm
>

Hi Davy,

Do you have any screenshots of the changes above showing what it should
look like?

Thanks for your help on this!

Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

jldominguez
Offline
Joined: 2008-01-02
Points: 0

Thank you Davy. I test b82 asap.

Lucas

jldominguez
Offline
Joined: 2008-01-02
Points: 0

Hello. With the personal profile CAB file (b85), I'm not able to create a java.awt.Frame that covers the system task bar, so I always get two bars, even if my Frame's height is 640 (my screen size is 480 x 640). As I said before, this worked with b46. I understood from your message that it should be possible with b85 as well. What am I missing?

Thanks.

Hinkmond Wong

phonemeadvanced@mobileandembedded.org wrote:
> Hello. With the personal profile CAB file (b85), I'm not able to create a java.awt.Frame that covers the system task bar, so I always get two bars, even if my Frame's height is 640 (my screen size is 480 x 640). As I said before, this worked with b46. I understood from your message that it should be possible with b85 as well. What am I missing?
>

Davy should be back on Monday (08Sep2008) if he doesn't reply while he's
away.

Thanks,
Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

jldominguez
Offline
Joined: 2008-01-02
Points: 0

Hello.

With the personal profile CAB file (b85), I'm not able to create a java.awt.Frame that covers the system task bar, so I always get two bars, even if my Frame's height is 640 (my screen size is 480 x 640). As I said before, this worked with b46. I understood from your message that it should be possible with b85 as well. What am I missing?

Besides, is there a way to prevent the user from moving an resizing a java.awt.Frame?

Thanks.

Hinkmond Wong

phonemeadvanced@mobileandembedded.org wrote:
> Besides, is there a way to prevent the user from moving an resizing a java.awt.Frame?
>

Davy should be back next Monday to answer your first part of your question.

For the second part of your question, you should not be able to move or
resize a phoneME Advanced app on Windows Mobile currently. How are you
able to do that? Do you grab the top titlebar with your stylus and can
you move the window dragging it? Also, are you able currently with b85
to grab the side or bottom grab handles to resize the window?

Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

jldominguez
Offline
Joined: 2008-01-02
Points: 0

Yes, the user can move and resize the java.awt.Frame, even if I said explicitly setResizable(false).

In fact, the bevavior and look of the java.awt.Frame in phoneME is one of the main disadvantages when you compare it to IBM J9.

In J9, awt controls look also austere, but the java.awt.Frame is perfectly integrated in the Windows system. The frame appears maximized without additional lines or margins along the borders, and the Frame's top bar does not interfere with the system's task bar. Of course the user cannot move or resize it, which does not make sense in a pocket pc.

Hinkmond Wong

phonemeadvanced@mobileandembedded.org wrote:
> Yes, the user can move and resize the java.awt.Frame, even if I said explicitly setResizable(false).
>
> In fact, the bevavior and look of the java.awt.Frame in phoneME is one of the main disadvantages when you compare it to IBM J9.
>
> In J9, awt controls look also austere, but the java.awt.Frame is perfectly integrated in the Windows system. The frame appears maximized without additional lines or margins along the borders, and the Frame's top bar does not interfere with the system's task bar. Of course the user cannot move or resize it, which does not make sense in a pocket pc.
>

Thanks for the info.

Davy P, do you know he flag setting for a Windows Mobile window style to
make it non-resizeable and maximized?

Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

Davy Preuveneers

Hinkmond Wong wrote:
> phonemeadvanced@mobileandembedded.org wrote:
>> Yes, the user can move and resize the java.awt.Frame, even if I said
>> explicitly setResizable(false).
>>
>> In fact, the bevavior and look of the java.awt.Frame in phoneME is
>> one of the main disadvantages when you compare it to IBM J9.
>>
>> In J9, awt controls look also austere, but the java.awt.Frame is
>> perfectly integrated in the Windows system. The frame appears
>> maximized without additional lines or margins along the borders, and
>> the Frame's top bar does not interfere with the system's task bar. Of
>> course the user cannot move or resize it, which does not make sense
>> in a pocket pc.
>>
>
> Thanks for the info.
> Davy P, do you know he flag setting for a Windows Mobile window style
> to make it non-resizeable and maximized?
>
> Hinkmond
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
> For additional commands, e-mail: advanced-help@phoneme.dev.java.net
Yes it is possible, but only during creation of the native window. So
not outside the constructor of the AWT Frame.
The question is, if you want this behavior on the PocketPc or not.
Indeed, most applications run full screen without being
resizable so if that is the behavior that is wanted, then I can change
the implementation

Davy

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net