Results 1 to 2 of 2
  1. #1
    MGeorge's Avatar
    MGeorge is offline Aging Hacker
    Join Date
    Sep 2014
    Location
    East (San Francisco) Bay, California, USA
    Posts
    22
    Rep Power
    0

    Default Need to hijack JMenu's display of its items

    I have a Java/Swing application with a typical menu bar and I really need to be able to customize the menu items on the fly (as the menu is being displayed). Sounds like it should be simple but I cannot figure out how to preempt the normal menu functionality. Is there a hook in JMenu (or JMenuItem) that allows me to register a listener to make adjustments to the menu item? I took a quick look into extending the Swing classes but that looks like a nontrivial effort.
    Any advice will be appreciated.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    27

    Default Re: Need to hijack JMenu's display of its items

    Maybe what you're looking for is JMenu#getPopupMenu()#addPopupMenuListener(...)#pop upMenuWillBecomeVisible(...).

    To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that demonstrates the problem.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Thread Hijack
    By Vbabey in forum New To Java
    Replies: 2
    Last Post: 08-03-2012, 11:48 AM
  2. Replies: 8
    Last Post: 12-10-2011, 05:54 PM
  3. JMenu help
    By Kyle227 in forum New To Java
    Replies: 3
    Last Post: 05-02-2010, 01:36 AM
  4. Replies: 8
    Last Post: 12-29-2008, 08:12 AM
  5. Display items in the JCombo Box
    By eddy001 in forum AWT / Swing
    Replies: 1
    Last Post: 01-21-2008, 01:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •