JTable, select row on right mouse click

Hi,
If I right click on a jTable row in my application, the row I click on does not get selected.
How can I modify the mouse listener attached to the jtable to deal with this?
jtable.addMouseListener( { e->
if (e.isPopupTrigger())
    swing.popupMenu(menuItems).show(e.getComponent(), e.getX(), e.getY());
} as java.awt.event.MouseListener)Thanks!

Problem solved!
jtable.addMouseListener( { e->
if (e.isPopupTrigger()){
    int row = jtable.rowAtPoint( e.getPoint() );
    jtable.changeSelection( row, 0, false, false );
    swing.popupMenu(menuItems).show(e.getComponent(), e.getX(), e.getY());
} as java.awt.event.MouseListener)

Similar Messages

  • JTable selection _only_ with right mouse button

    I have a JTable and my code is responsible for selection. All selection should only be done with the right mouse button. The left on will be used for other purposes. However, I do not know how to stop selection with the left mouse button.
    Currently selecting with the right mouse button does the selection in "my way". Klicking with the left mouse button still offers selection the "default way". I want to disable this default way. How can this be done?

    First you get the ListSelectionModel of the jtable. Then use setSelectionInterval to set selection. Look at following code:
    table_list.addMouseListener(new MouseAdapter() {
    public void mousePressed(MouseEvent e) {
    showPopUp(e);
    public void mouseReleased(MouseEvent e){
    showPopUp(e);
    private void showPopUp(MouseEvent e){
    if (e.isPopupTrigger()){
    menu_point.setLocation(e.getPoint());
    ListSelectionModel lsm = table_list.getSelectionModel();
    lsm.setSelectionInterval(table_list.rowAtPoint(menu_point),table_list.rowAtPoint(menu_point));
    popup.show(e.getComponent(),e.getX(),e.getY());
    });

  • Select item with Right Mouse Click

    hello, this is a pretty simple idea: i want to be able to have an item in a JList be selected when i RIGHT click on it, not just left click.. i want to do this because i have a popup menu come up, but i also want the item that the mouse is over to be selected, so the user doesnt have to left click an item, then right click...
    im pretty sure theres a way to do this.. i looked through documentation, but had no luck.. thanks a lot,
    Steven Berardi
    ------------------------

    hi,
    combobox.addMouseListener(this)
    public void mouseClicked(MouseEvent e)
    if(me.getModifier()==MouseEvent.BUTTON3_MASK)//rechte Maus
    String item=combobox.getSelectedItem();
    implement the other methods for interface mouselistener

  • How to select a row in JTable for right mouse click ?

    Hi All,
    I need to select a row on JTable for right mouse click ?
    Can any one help me ?
    Thanks a lot.
    Seelam.

    Got solution...
    tabel.addRowSelectionInterval(..) works.
    thanks.

  • How to Select  a Row in a JTable, on a right mouse click?

    Hi all!
    I need to know the Row index in a JTable, on a right mouse click?
    Executing following code, I get the "Column Number" on a mouse click
    TableColumnModel columnModel = tableView.getColumnModel();
    int viewColumn = columnModel.getColumnIndexAtX(e.getX());
    int columnIdx = tableView.convertColumnIndexToModel(viewColumn);
    Dows any body know the code that gets "rowIdx" on a mouse e.getY() method??
    Hope early response!

    int row = table.rowAtPoint( e.getPoint() );
    int column = table.columnAtPoint( e.getPoint() );

  • I am using FireFox 4. Where is the "Bookmark All Tabs-" feature. I would like to save my Tabs for a later session. The selection is not on the menu when I right-mouse click or go to the Bookmarks feature of the Menu.

    Missing "Bookmark All Tabs…" feature which was in previous versions of FireFox 3.x. If you right-mouse click on a neutral part of the Browser window, there would be choice of "Bookmark this page" or "Bookmark All Tabs…". I have been unable to find it either in the sub-menu or the BOOKMARK selection from the Menu Bar.

    What do you mean by Tabs sub-menu is it right-clicking on a tab ?
    I know that "ctrl-shift-D" still work.
    I know that a right-click on a tab gives the "Bookmark all Tabs" function.
    But I would like to see it back in the Bookmarks menu. (which is its logical place)
    Because today the choice only disappeared from the menu as it is still reachable through keyboard shortcut or through mouse right-click on a tab
    but tomorrow it will totally disappear and personally I don't want that as this is one of my favorite functionality.
    Tank you for your understanding !

  • How do I fix error message "This document contains a link to an asset being upsampled. You should resize it smaller or right-mouse click on the asset in the Assets panel to see additional options." Which asset is it?

    I ab in Muse. How do I fix error message, This document contains a link to an asset being upsampled. You should resize it smaller or right-mouse click on the asset in the Assets panel to see additional options.

    You should ask in Help with using Adobe Muse CC
    This Cloud forum is not about using individual programs
    This Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • Right Mouse Click Error Message

    I have captured a software simulation using Captivate 6 which requires the user to advance to the next slide via a right mouse click (RMC). I have the accessiblity features switched off. However from the LMS when I RMC I get an error message refering me to the course .htm file.
    Has anyone else came across this and if do how can I fix it.

    You should ask in Help with using Adobe Muse CC
    This Cloud forum is not about using individual programs
    This Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • Diable "open dialog box" on right mouse click so I can use l mouse to advance to next slide and r mouse click to "go back."  How in PP 2010 for mac????

    I do presentations in PP10.  I am new to macair, and used to Windows.  HOW DO I DISABLE THE "OPEN DIALOG BOX ON RIGHT CLICK"?  I would like to use L mouse to advance slide, and R mouse to go back.  The default is to use R mouse to open dialog box.  I can disable this by unchecking the box in "advanced" on the PC.  How do I do it with the Mac????
    Thanks
    hacmd

    Hi Rod,
    As originally stated in my opening post, the SWF is to be inserted into an Articulate '13 slide (what I called an aggregator originally - I tried not to bring them up since I don't want the chatter about "There's your problem - using Articulate"! ).
    Recall that posting this published file to our LMS did not allow right-mouse click functionality as the flash player menu just gets in the way.
    If I insert the captivate 6 files into Articulate as a Web Object (referencing the entire folder with html, htm and assets, and then posted to our LMS, and it DOES allow RM click operations in both IE and FF (although no sound on the Captivate slide in FF). But this is not what we want to do as this introduces 2 navigation controls (the Captivate one and the Articulate Player).
    Why must anything be posted to a web server for this functionality to work?
    I am able to go into the Captivate 6's published folder, and launch the Captivate demonstration by simply double clicking on the index.html file and this works great in both FF and IE after changing the security settings for flash.
    Again - I can not believe I am the only one out there trying to use the right-mouse click feature to do a software simulation by embedding the Captivate SWF into an Articulate '13 project.

  • Help on right mouse click in swing GUI.

    I am working on a swing GUI interface which has Panels. One Panel contains two sub panels. I want to add the Right Mouse click feature to the panels. How should i go about achieving this? Please provide sample example if any.
    Thanks in advance.

    anyPanel.addMouseListener(new MouseAdapter(){
       public void mouseReleased(MouseEvent e){
          if(e.isPopupTrigger()){
              // right clicked
    });

  • Right mouse click in word for mac

    i just bought a g-5 intel core duo and i love it. though i am an experienced mac user this is my first time with the mighty mouse and i miss the right mouse click when i am in word for mac (2004): with my old mouse i could right mouse click on a word and get immediately into the thesaurus/dictionary, whereas with the one-click mighty mouse i have to go to tools, then thesaurus or dictionary, which takes several clicks. is it possible to program the mighty mouse so that i can get with one click to the thesaurus dictionary? thanks in advance. mmvski from amsteram

    Are you trying to do this in Word for Mac or Word for Windows?
    The Mighty Mouse buttons can be programmed on Mac OS X using Apple menu --> System Preferences --> Keyboard & Mouse.
    On Windows go to Start --> Control Panels --> Mouse.
    Hope this helps! bill
    1 GHz Powerbook G4   Mac OS X (10.4.8)  

  • When I use Mail and want to paste an emailadress with a right mouse click in the adres field this doesn't work, ofcourse cmd V  works. How can I solve this

    when I use Mail and want to paste an emailadress with a right mouse click in the adres field this doesn't work, ofcourse cmd V  works. How can I solve this

    YAY!  That did it.
    Thank you so much.
    And a Very Happy and Prosperous New Year to you!
    bonnie

  • Acrobat tries to reinstall when I right-mouse click - vista 32 bit

    I bought and installed Adobe Master Suite. Now, whenever I right mouse click my start menu (or any icon for that matter), I get a message saying Acrobat needs to be configured, at which point Acrobat begins to reinstall itself. WOW. I must say i have not seen a bug like this since circa Windows 95. Makes me wonder how extensively Adobe tested Acrobat 9 with Vista 32 bit. Yikes. What next ? BSOD's?
    Snarkiness aside,  can anyone tell me how to fix this problem? I only found one instance in Google search, and of course it was one associated with the dreaded experts-exchange.com (we can only pray they will hire a careless sys admin who will accidentally nuke all their servers).
    A few other posts said the only way to fix this issue is to re-install (tried it, doesn't work), or remove some registry keys to remove the Acrobat entry from the right mouse click context menu (which I don't want to do)
    HELP
    Thanks all
    Mark

    I'd recommend uninstalling Acrobat. Run the Microsoft Installer Cleanup tool to remove all remnants of Acrobat and then re-install.

  • Is it possible to Disable Right Mouse click In WebDynpro Java Application??

    Dear Experts,
    Is it possible to Disable Right Mouse click In WebDynpro Java Application??
    If yes then kindly suggest how.
    Warm Regards,
    Upendra Agrawal

    What is the use-case?
    Armin

  • Right mouse click

    Is there are a way to add a right mouse click to a button in Actionscript 1?
    Thank you so much for you help.
    Angela

    Flash uses contextMenu for right click .... code reference -
    http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=Part2_AS2_LangRef_1.html

Maybe you are looking for

  • IPhoto can't delete photos from iPhone 6

    Hello Everybody. I just wondered why my iPhoto can't delete the photos from my iPhone 6. When i have imported the photos from the iPhone, i get the opportunity to delete photos from iPhone device, but when i press delete nothing happends on my iPhone

  • Can we stream music to Bose speakers thru Apple TV?

    Can we stream Music to Bose speakers thru apple TV

  • Archive Utility and permissions

    I was wondering if there was a way to instruct Archive Utility to use the default permissions when expanding a file. Without a long-winded explanation...I have two users using the same iMac to download client files from various FTP sites. With one us

  • MLR.EXE on Windows 2003 64 BIT using WOW64

    Hi I have installed a SAP SCM 5.0 system on Windows 2003 64 BIT/MS SQL 2000. The SCM consultant needs the MLR.EXE exe installed on the OS for the RFC connection 'CALL_MLR', I have followed OSS Note 301569, copied the exe to the OS in the /usr/sap/<SI

  • Google Not Working/Popups!?!

    Hi I am running the most up to date version of Snow Leopard and Safari. I haven't been to any abnormal websites or anything, but for some reason sometimes when I'm on legit websites (even Apple) I will click a link and another window will pop up that