How do i right click on a jpanel and make a menu come up where i clicked

basically i want to allow the user to click on screen and a menu popup where they clciked which has a list of options such as A,B,C.
I think you have to use a menuBar method or something. im not 2 sure
anyone have some quick code.

when the mouse is pressed, mousePressed method is called. Something like this in that method should be put.
pubic void mousePressed (MouseEvent e)
      if (e.getButton() == MouseEvent.BUTTON3) // Block for triggering popup
            JPopupMenu menu = new JPopupMenu ();
            menu.add (new JMenuItem (....));
            menu.show ([put the jpanel name here], e.getX(), e.getY());
}Edited by: Cricket_struck on Feb 1, 2009 5:08 PM

Similar Messages

  • Flex 3 : How  to capture   right click on DataGrid ??

    I am using Flex 3 . I have some data inside a DataGrid .
    Now when we the user right clicks on Datagrid Item , i want to show an Alert ??How  to capture 
    right click on DataGrid ??
    Please suggest ,thanks

    Thanks for the resonse , I did not understand what is context menu and how it it associated with Datagrid's right click , could you please elobrate ?? Thanks .

  • How does one right click using the iPad?

    how does one right click when using the iPad?  I am needing this in a citrix app

    You can usually just tap and hold on certain things to access the right-click menu. It works in almost all cases. :)

  • How to disable right click in a transaction?

    Hi,
         How to disable right click in transaction.
    i.e, While in CRMD_BUS2000111, in partners tab, when we right click, a pop up window appears. I don't want this to happen. I don t want the window to pop up.
    How can this be achieved witout changing any standard code?
    Regards,
    Varun

    Hi Amit,
    Tcode - CRMD_BUS2000111
    Regards,
    Varun

  • I don't seem to be able to right click on the macbookair mousepad; how do i right click?

    How do I right click with the MacBook Air using the mousepad?

    Silly rabbit wrote:
    Hold down the shift key
    On yours it's the SHIFT key?
    Out of the box, most Macs use the "fn" key in concert with the trackpad tap to perform right clicks.
    On all three of my Macs, it is the fn key that is used. The shift key does nothing in regard to trackpad clicks, except It does however make all text selected to the right of the cursor.

  • How do i right click when a red line appears under a misspelled word?

    i need help. im new to pages, and when i misspell a word a red line shows up underneath just like in micrsoft word, but the problem is i dont know how to correct it. how do i right click to view the correct spelling?

    Double-click to highlight the word & then right-click just as you would anywhere elese. Suggestions will be at the top of the list. Many times there are no suggestions.
    Of course, make sure secondary click is turned on in the mouse preferences in System Preferences.

  • How do I right click using the mouse on the mac desktop ?

    how do i right click using the mouse on the mac desktop

    does this involve iPhoto for the Mac in any way?
    the simple answer given no actual information is to press down on the right mouse button
    LN

  • How do i right click on mouse

    how do i right click on mouse

    Go into System Preferences and click on Mouse and set up to right click.
    If it is 3rd party mouse go to there web site or download from the cd that came with it and set it up
    You may have to download the drivers from the site.
    Cheers
    Don

  • How do I right click a link on iphone5?

    How do I right click a link on iPhone 5.

    you can't download anything to ios devices from browsers

  • How do I 'right click' on my mac book pro?

    How do I 'right click' on my mac book pro?

    Or buy a proper multibutton mouse.
    (Heh, heh, now He will roll in the grave after having uttered such a sacrilegy in the Church of Steve...)

  • How do I right click without a mouse?

    How do I right click without a mouse?

    If you don't like the two finger tap (I don't - it doesn't seem to work consistently) you can asign one corner as a right-click or simply use the control click with one finger on the bottom (which is what I do, usually - just a habit left over from the old days).
    Clinton

  • How do i right click on my iphone 4s

    how do i right click on my iphone 4s

    You don't. There is no such thing as a 'right click' since there is no mouse, and no mouse buttons.  In some cases, you can touch and hold to get a list of options for a link, etc.

  • How do I right click on OLD Apple mouse that is white / oval shape?

    How do I right click on the older version of Apple mouse?
    Please do not tell me to buy a new one, I myself have new mac mini with trackpad, but need to help friend in wheelchair who lives in healthcare facility fix an app on his iMac, need to right click to do it.  We cannot get on internet there to download mouse drivers for a different mouse.
    Thank you in advance for your thoughts.

    Look for secondary (right) click settings in Mouse system preference.  If there are none then the mouse does not have right-click.  In that case you can right-click by holding the Control key while clicking.

  • HT3986 How do I right click on Windows installed using Bootcamp?

    How do I right click on Windows installed using Bootcamp?

    It should work the same way it does in OSX, but for it to work correctly, you need to install the Boot Camp drivers in Windows. You can do this by using the Boot Camp Assistant in OSX, then creating the "Windows support software (drivers)" package. Follow the instructions there, then use the resulting thumbdrive to install the drivers and apps into Windows. Then you should be able to two-finger-click the touchpad or right-click your mighty mouse or other two-button-enabled mouse.
    http://support.apple.com/kb/HT4407 for more info on this.
    Caveat: I've done this, and I've found that the two-finger-click in Windows is iffy. That is, it frequently triggers a left-click function instead of right-click. :-/

  • How do you right click on an ipad?

    How do I right click on the iPad screen?

    I did try that, but got only three options: open, open in new window, and copy. I'm trying to download a PDF file that's posted on https://bb.uis.edu/webapps/login/. It'd be nice to do that directly to my iPad without having to go home, download it to my computer, and then transfer it to my iPad.
    It's hard to believe that the feature just isn't there, since this is such a common Web operation. I keep thinking that I just need to find the right trick.

Maybe you are looking for

  • Two person using One Account same time with differ...

    2 days ago when i using skype chat with my friends , my girlfriend login to my skype account from different ip and watched all our conversation than sended to me ? How it can be.? Where is the privacy? 1 account using two person at the same time 1 is

  • Itunes 8.2.0.23 upgraded now crashes before opening

    As per title, after installing the new ITunes to upgrade my iphone firmware it repeatedly crashes when opening. The error in the event log is: Faulting application itunes.exe, version 8.2.0.23, faulting module itunes.exe, version 8.2.0.23, fault addr

  • My nano screen is friggin messed up...BAD.

    well...i dont kno exactly wat happened i just cut my nano on and the half of the screen is blank...and on the right side theres this weird...idk it looks like some kind of funky scroll bar...but other than the screen being completely screwed it plays

  • Strange graphics pixels - red, blue, green. They move & dissappear - help!

    Some of my top bar icons are obscured/replaced by thouisands of red, blue, and green pixels. The entire dashboard widgets are obscured the same way. It comes and goes. Sometimes if I drag a windown or cursor over it it goes bacxk to normal. Macbook P

  • Ipod /iCal to-do/ sync

    Does anyone know how to sync my ical to-do lists onto my nano? I am able to get my calendar, but not my to-do list, it would be super-helpful to be able to be take it along!! Thanks to anyone in advance!