How to modify an opened menu ?

C

Carsten Zerbst

Hello,

I have a menu in my application which offers several connection options
after doing a network lookup. The menu is currently build triggered by a
JMenuLister. The lookup is typically slow and the menu will
open with a noticable delay.

I wanted to use the same method I use in the trees,
* first display a string "Updating .." and start the query in another
thread
* remove the updating JMenuItem and replace by the real ones.

This does work, but the opened menu (or better its JPopup) is not
redrawn properly. Though I remove the updating item and add new
ones in the AWT Event Thread, all new items are squezed together in the
space of the former updating item :-(

I experimented using something like menu.getPopup().validate
but the opened menu is not drawn correct.

Any tips appreciated, Carsten
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top