Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "Thomas Kellerer" Subject: [Swing] Lazy sub-menu ini Message-ID: <4uv16uF19it44U1@mid.individual.net> X-Comment-To: comp.lang.java.gui Newsgroups: comp.lang.java.gui Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 67 Date: Wed, 27 Apr 2011 15:27:40 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303918060 96.60.20.240 (Wed, 27 Apr 2011 10:27:40 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:27:40 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.gui:461 To: comp.lang.java.gui Hallo, I have a popup menu that includes two sub-menus that are populated from the database. As this take some time, I am not retrieving those entries when creating the popup menu, but instead add a menuListener and in the menuSelected() event I am retrieving the information from the database and populate the sub-menu. This is working fine, but I'd like to give the user some visiual feedback that a retrieval is going on. I did not succeed in showing an hourglass cursor by calling setCursor() on the popup menu. Ideally I'd like to have a "dummy" item in the sub-menu that shows (Retrieving), and once the retrieval is finished this is then replaced with the correct entries. I tried this by adding the default item and kicking of the DB retrieval in a separate thread. However the dummy entry is never shown for some reason. I still get the lag when selecting the menu item and then the DB items show up. Any ideas or samples on how I could achieve this? The menu looks like this: +------------+ | Item 1 | | Item 2 | +------------+ | Submenu1 > | | Submenu2 > | +------------+ Where submenu1 and submenu2 are the two items that are populated from the DB. My ultimate goal is to display it like this, when submenu1 is selected (but not yet retrieved) +------------+ | Item 1 | | Item 2 | +------------+ | Submenu1 > | +---------------+ | Submenu2 > | | Retrieving... | +------------+ +---------------+ Once the retrieval is finished it should display +------------+ | Item 1 | | Item 2 | +------------+ | Submenu1 > | +-----------+ | Submenu2 > | | Db Item 1 | +------------+ | Db Item 2 | | Db Item 3 | +-----------+ Cheers Thomas --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24