Why all JMenuItem's of JPopupMenu perform the same action?

Why all JMenuItem's of JPopupMenu perform the same action?
I trying to do something similar to what there is in JBuilder where you right click a method or a class - you get a popUpMenu and if you choose the
"Browse Symbol" JBuilder browses to that method/class.
I'm trying to do the same and to browse to some class of mine (not a java class). But there's a problem.
This is my code : -
OMClass desiredClass = event.getNavigationClass();
if(desiredClass instanceof OMComplexClass) {
Set classSet = desiredClass.getSimpleClasses();
JPopupMenu menu = new JPopupMenu();
JMenuItem menuItem = null;
menu.add("Browse to :");
menu.addSeparator();
Iterator it = classSet.iterator();
for(; it.hasNext(); ) {
OMConcept concept = (OMConcept)it.next();
menuItem = new JMenuItem(concept.getName());
menuItem.addActionListener(new NavigateToComplexClass(concept));
menu.add(menuItem);
menu.show((JComponent)(event.getMouseEvent().getSource()), getX(), event.getMouseEvent().getY());
ComplexClass is build of SimpleClasses - so if I want to browse to complex class I ask the user by a JPopupMenu what specific SimpleClass he would like to browse to. My ActionListener is a NavigateToComplexClass class - and hewe is the code : -
public class NavigateToComplexClass implements ActionListener, ItemListener {
private static OMClass classToShow = null;
GUI_Location currentLocation = null;
public NavigateToComplexClass(OMConcept desiredClass) {
classToShow = (OMClass)desiredClass;
public void actionPerformed(ActionEvent evt) {
currentLocation = frame.fillGUI_Location();
frame.getProject().getHistoryManager().updateHistory(currentLocation);
if(classToShow == null) {
return;
frame.getClassDisplay().getTabbedPane().setSelectedIndex(1);// 1 - parameeter : Property tab.
frame.getConceptViewPanel().selectConcept((OMConcept)classToShow);
public void itemStateChanged(ItemEvent e) {
The problem is that no matter what JMenuItem I select and press it's navigating to the same simpleClass like if I have a
b
c
no matter what I'll press I'll always goto a (or b or c but always the same)

hi,
for your actionlistener all those items are more or less the same. when browsing to them you have to give them different names or better different actioncommands.
regards

Similar Messages

  • Firefox opens duplicate windows performing the same actions microseconds apart. I noticed it because videos had an echo. Then I made an online donation--triggered 2 email confirms and 2 charges to my credit card. Help?

    This has been going on for a week or two.

    Does this still happen if you restart Firefox in safe mode? For instructions, see '''[[Troubleshooting extensions and themes]]'''.

  • Why doesn't ical add all of my google calendars on the same page?

    why doesnt ical add all of my google calendars on the same page.
    like in gmail, i have different calendars that all show up together on the same page.
    i see that they are there in ical when i click window. but the are not all see together on one page.

    If the box next to each calendar in the list is checked, it should show the contents of the calendars on the page. Unchecking the box hides the calendar.

  • I can connect to all contacts except for people on the same "bill" as me.  Why is that?

    I can connect to all contacts expect for people on the same "bill" as me.  Why is that?

    What does can't connect mean in regards to placing/receiving calls? Your iPhone doesn't ring when calling one of the numbers on the same account and bill, or your iPhone rings but the recipient's phone doesn't ring?
    Have you called the carrier?

  • Why quality sytem disk space  should be the same as Production disk space

    Hi All,
    Why quality sytem disk space should be the same as Production system disk space. Please give few points and also the impact if the disk spaces are not same. Its URGENT.

    Karunakar,
    It all depends on what you do with your QA system. I personally don't think QA and Prod should be of the same size.
    QA is your testing environment, the one where you perform the final tests and validations before going to Prod.
    In my personal experience and practice, for QA:
    - Daily loads of Master Data - Master Data is good to keep it updated, for obvious reasons
    - No daily transactions loads - You can load your transaction data on demand, depending on the specific area you need to test. You can initialize and load sample periods or sets of data. Once you're done, that's it.
    - No copy from BW Prod to QA - You really don't need to. As far as they do "refresh" from R/3 Prod to R/3 QA, you'll have data in QA good enough to test. Also, copying Prod to QA in BW can mess your transports sequence and put the systems out of sync or make you re-transport requests that were already in QA but not in Prod. Also, by doing those copies, it's like having two Production systems to maintain... Your landscape and maintenance costs will grow much faster
    In my opinion, Development and QA have a controlled growing, following those guidelines. Only Prod will keep growing during time, which makes sense.
    My 2 cents...
    Regards,
    Luis

  • Why, with iCloud, do we continue receiving the same email on multiple computers?

    Why, with iCloud, do we continue receiving the same email on multiple computers? Is there a way of stopping this?

    If those multiple computers are all setup to use the same iCloud account, then it is working exactly as intended. That's what iCloud does. Keeps your email, contacts, calendars, bookmarks, tasks etc. in sync across all devices/computers that the same iCloud account is setup on.
    If you want independent email on each device/computer, you need to setup independent email accounts for each device/computer.

  • If the ipad charger charges the iphone faster, why didn't they Apple just make the same charger for iPhone?

    If the ipad charger charges the iphone faster, why didn't they Apple just make the same charger for the iPhone?

    Apple does not do this at all anywhere at all.
    The carrier is the ONLY one who will unlock an iphone.  No one else.
    AT&T does NOT unlock iphones.
    Sorry.

  • Why cant i talk and surf at the same time?

    Why cant i talk and surf at the same time? Got lost yesterday and while on the phone i couldn't search store web to get the address. Perfect timing to figure this out; when you're lost.  This is a MAJOR problem for me and anyone on the go. WHEN WILL THIS BE FIXED??? I will not hesitate to return this phone as im sure all TURBO users feel the same. Someone said the MOTO X was the same way... is it still...why hasn't then been fixed by now? Which now makes me wonder if this wasn't an oversight but something intentional. Why did they hide the fact that they knew this was going on? i should have been told that this capability wasn't available on the TURBO at time of purchase. FIX IT NOW!

    ChristiLockridge wrote:
    And i've had every DROID since the original with the exception of the Bionic.
    Then you have had phones WITHOUT the capability of talk/surf at the same time. If you don't realize this, then you don't(or at least didn't) use it as often as you think. Original Droid didn't have this capability. Droid X didn't have this capability. Droid X2 didn't have this capability. For the most part(there may have been exceptions of which I am unaware), NO Verizon phone had this capability until 4G phones and then ONLY when on a 4G LTE signal. 4G phones on a 3G signal did not/do not have this capability.
    ChristiLockridge wrote:
    The same as texting, or calling or browsing. This is just a given.
    Personally, I check these things on EVERY phone before I purchase. This is just a given.

  • I delete some emails ,there are moved to trash . I delete them from trash folder too and they still appear in a folder called 'all messages". I repeat the same actions and after a while they appear again!what should i do to delete them permanently??

    I delete some emails ,there are moved to trash . I delete them from trash folder too and they still appear in a folder called 'all messages". I repeat the same actions and after a while they appear again!what should i do to delete them permanently??

    If you are using Apple's Mail app 6.5 is the latest version irrespective of what a previous poster says. It does sound though that you are using a gmail account online via a web browser. Please confirm and fill in missing information.

  • Hi! I have a library of around 1000 songs on my iTunes, I recently synced my phone and all was lost, my partner has the same songs on hers with a different sign in, but not backed up anywhere, any suggestion on how I can store her tunes in my account ???

    Hi! I have a library of around 1000 songs on my iTunes, I recently synced my phone and all was lost, my partner has the same songs on hers with a different sign in, but not backed up anywhere, any suggestion on how I can store her tunes in my account ??? Then sync them to mine? When I sign her phone into her account I get a message warning that if I sync the dogs on her phone will be replaced by the ones in the library! But as there are no songs there I'm reluctant to continue!!! Please help this non techi guy.!!!!!

    Hello Solid Buck,
    Thank you so much for providing the details about the duplicate song issue you are experiencing.  It sounds like you would like to remove the duplicate songs that will not play on your iPhone, but when you connect it to iTunes, iTunes only shows you one copy of the song on your iPhone. 
    In this situation, I recommend deleting the individual songs that do not play directly from your iPhone.  I found the steps to do this on page 61 of the iPhone User Guide (http://manuals.info.apple.com/en_US/iphone_user_guide.pdf):
    Delete a song from iPhone: In Songs, swipe the song, then tap Delete.
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Is there a way to "Quit" all running apps in dock at the same time verses right-clicking each one individually?

    Is there a way to "Quit" all running apps in dock at the same time verses right-clicking each one individually?

    IIRC, OPTION-click on the Apple icon on the menu bar and select either Restart or Shutdown. Alternatively,
    Control-Command-Eject
    Quit all applications (after giving you a chance to save changes to open documents), then restart the computer
    Control Option-Command-Eject
    Quit all applications (after giving you a chance to save changes to open documents), then shut down the computer

  • There is no email program associated to perform the requested action. Please install an email progra

    I am operating on Windows 8 and using Adobe Reader XL (11.0.03) and get the following message when I open the a file
    There is no email program associated to perform the requested action. Please install an email program or, if one is already installed, create an association in the Default Programs control panel
    I went to Edit - Preferences - Email Accounts - and added a gmail account but it is still happening!

    I'm also getting this message from Adobe Reader XI when opening files from Windows Explorer. OS is Windows 7.
    I'm not trying to perform any email action, is there a way to disable this annoying popup?
    Edit: After some googling, it looks related to this: http://helpx.adobe.com/photoshop-elements/kb/freeze-or-error-no-email.html
    This is pretty poor if users can't disable this notification without installing a separate, unnecessary program.

  • There is no email program associated to perform the requested action. Please install an email program or, if one is already installed, create an association in the Default programs control panel

    I just installed Window 7 professional in place of Windows 7 Ultimate RC to which I subscribed. I was not pleased to do a clean install as opposed to an upgrade and was not informed about it.
    When I reinstalled Office 2007, my outlook does not work, although exchange on the web works. I get the following error message:
    There is no email program associated to perform the requested action. Please install an email program or, if one is already installed, create an association in the Default programs control panel 

    Louis,
    This issue may occur if the Outlook registry key is corrupted. When other programs try to use the Outlook Simple MAPI interface, they cannot retrieve the required information from the registry.
    You must first remove the corrupted Outlook registry key, and then perform a Detect and Repair operation to have Outlook rebuild the key. To do this, follow these steps:
    Click Start, and then click Run.
    In the Open box, type regedit, and then press ENTER.
    In Registry Editor, locate the following subkey in the registry: HKEY_LOCAL_MACHINE\Software\Clients\Mail\Microsoft Outlook
    Select the subkey, and then press DELETE.
    Click Yes.
    Quit Registry Editor.
    Start Outlook.
    On the Help menu, click Office Diagnostics.
    Follow the instructions on the screen to complete the repair.
    Important: Above section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
    322756  (http://support.microsoft.com/kb/322756/ ) How to back up and restore the registry in Windows.
    Hope above information helps.
    Pooja Katiyar

  • When I want to randomly play (shuffle) all my songs, it seems that the same songs are being played. I've got over 13,000 songs loaded - it seems to me that I shouldn't be getting any repeats.

    When I want to randomly play (shuffle) all my songs, it seems that the same songs are being played. I've got over 13,000 songs loaded - it seems to me that I shouldn't be getting any repeats. I unrated all the songs, thinking this might affect how often a song gets picked to play. Any suggestions? Thanks!

    When I want to randomly play (shuffle) all my songs, it seems that the same songs are being played. I've got over 13,000 songs loaded - it seems to me that I shouldn't be getting any repeats. I unrated all the songs, thinking this might affect how often a song gets picked to play. Any suggestions? Thanks!

  • Hi I am running a dual core Win7 64bit PC with Firefox Regular and Nightly on it. I also have 32bit Win XP Virtual PC on the same PC with Firefox... How do I sync all of them to give me the same bookmarks, history, cookies and passwords ??? TIA... Rick...

    Hi... I am running a dual core, Win7 64bit PC, with Firefox Regular and Nightly on it... I also have 32bit Win XP Virtual PC on the same PC with Regular Firefox... How do I sync all of them to give me the same bookmarks, history, cookies and passwords ???

    I assume that you have separate Profiles for the Release and Nightly installations.
    https://support.mozilla.com/en-US/kb/What+is+Firefox+Sync
    Add each Firefox Profile to your Sync account as a '''new device'''. <br />
    https://support.mozilla.com/en-US/kb/add-a-device-to-firefox-sync

Maybe you are looking for

  • Song Titles Get Cut Off

    I have decided to convert all of the music on my computer from MP3 to AAC format, but when i convert songs the titles tend to be cut off after 35 characters or less. A good portion of my music has rather long names in the file titles because some of

  • I dont find music in the itunes. this music get out from itunes

    my music get out from my Macbookpro after atualization to itunes. what's happened?   Now i just see *!* in the many music. Anybody Help.

  • Transferring music from IPOD to Laptop

    I no longer have access to the computer I originally set up my IPOD with. How do I get files to transfer from my IPOD classic (30GB)to my new computer? When I open the IPOD in My computer, I can find no music folder.

  • GTS Web Functionality

    Hello GTS Experts... We are implementing GTS in our organization and we have a business requirement of letting suppliers enter their NAFTA certs via a webpage. We would like to create a page using BSP and have it available via ITS or EP for suppliers

  • Mouse pointer jumping around screen!

    hey guys, iv had my iMac for around a year now and only recently iv noticed that the mouse pointer just jumps randomly across the screen when i move it, like ill be moving the mouse to the right and itll jump across half the screen to the left. It ha