Skip to main content

Multiple command menu

3 replies [Last post]
ahi
Offline
Joined: 2008-06-11
Points: 0

Hi,
I would like to set on my phone two menu Command.From the right side i would like to have 3 commands and from the left side i ould like to have 2 commands. How can i select which of them will go from the right side and which of the other from the left side?
thanks

Reply viewing options

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

Hi Ahi,
The menu has one popup to show the commands.
The developer can control on what side he would like to popup to
appear(right or left), but you cannot have 2 popups at the same Form.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> Hi,
> I would like to set on my phone two menu Command.From the right side i would like to have 3 commands and from the left side i ould like to have 2 commands. How can i select which of them will go from the right side and which of the other from the left side?
> thanks
> [Message sent by forum member 'ahi' (ahi)]
>
> http://forums.java.net/jive/thread.jspa?messageID=280389
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

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

Matteo Mazzotti

Hello all,
I have a background thread that reads data from a socket stream and has to
update a ListModel used by a List view (yep, I'm still working on that).

The first time the network thread is started is upon a user's click on a
menu command.
So, in the code I did something like this:

public void actionPerformed(ActionEvent event) {
netThread.start();
appropriateForm.show();
}

The problem is that the new form relies on data read by the netThread , and
as soon as the form is created, no data is available yet, thus I get a "null
pointer exception" error.

What is the best way to "synchronize" (I admittedly use the term improperly)
the two threads, so that the EDT waits for the netThread to complete its
work? Or should I consider a totally different approach to this problem
(data coming from the network and views to be updated accordingly)

Thanks
Matteo

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

chen

Hi Matteo,
There are at least 2 options to do what you are looking for:
1)Pop up a modal dialog or a form with no commands show a progress
indicator and then show your next form when the network thread has
finished upload the data.
http://lwuit.blogspot.com/2008/05/progress-indicator-threads-in-lwuit.html

2)Display the Form with no data and let the network thread run in the
background.
The DefaultListModel fires the data changed event whenever an item is
added/removed/changed, the List itself listens to these events and
refreshes the view accordingly.

If you have implemented the Model yourself make sure you implemented the
*addDataChangedListener(DataChangedListener l)
removeDataChangedListener(DataChangedListener l); *methods as well.

Then make sure to fire the added/removed/changed event when your model
has changed.

Regards,
Chen

Matteo Mazzotti wrote:
> Hello all,
> I have a background thread that reads data from a socket stream and has to
> update a ListModel used by a List view (yep, I'm still working on that).
>
> The first time the network thread is started is upon a user's click on a
> menu command.
> So, in the code I did something like this:
>
> public void actionPerformed(ActionEvent event) {
> netThread.start();
> appropriateForm.show();
> }
>
> The problem is that the new form relies on data read by the netThread , and
> as soon as the form is created, no data is available yet, thus I get a "null
> pointer exception" error.
>
> What is the best way to "synchronize" (I admittedly use the term improperly)
> the two threads, so that the EDT waits for the netThread to complete its
> work? Or should I consider a totally different approach to this problem
> (data coming from the network and views to be updated accordingly)
>
>
>
> Thanks
> Matteo
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

[att1.html]