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());
});

Similar Messages

  • DoDragDrop oddity with Right Mouse Button

    Hi all,
    More experimentation - today with Drag & Drop.
    Everything seems fine when performing this with the left mouse button, but when initiating this from WPF
    with the right mouse button it appears to trigger the PreviewDrop event on the originating object.
    I've tried intercepting QueryContinueDragHandler, which is fired and is having an Action set of Continue - all to no avail.
    Much time with google shows no examples of people using the right mouse button with DoDragDrop, and a single query on this forum in September with someone having a similar problem.  No replies to that thread - hopeing for more luck today!
    So, has anyone successfully initiated a system based Drag/Drop using the right mouse button?  In this case I'm working with a ListView, but I suspect that is fairly irrelevant.
    Events occuring with Right Mouse Button depressed (and dragging a small way) are:
    Call to: System.Windows.DragDrop.DoDragDrop
    Callback: DropSource_ContinueDragEventHandler
    Callback: DropTarget_PreviewDragEnter
    Callback: DropSource_ContinueDragEventHandler
    Callback: DropTarget_PreviewDrop
    With the Left Mouse Button:
    Call to: System.Windows.DragDrop.DoDragDrop
    Callback: DropSource_ContinueDragEventHandler
    Callback: DropTarget_PreviewDragEnter
    Callback: DropSource_ContinueDragEventHandler
    Callback: DropSource_ContinueDragEventHandler
    Callback: DropSource_ContinueDragEventHandler
    etc...
    Anyone aware of any issues in this area?
    Thanks,
    Glyn
    PS: The behaviour is different if dragging something from another application / desktop to a drop target, so it appears to be related to the originating side of things. ie, there is no problem when dragging an object from the desktop or similar.

    Hmm - seem to have found the problem - it is related to the ContinueDragEventHandler!
    Here is a suitable handler for dealing with Left & Right mouse button drags
    You can activate it using:
    DragDrop.AddQueryContinueDragHandler(this, QueryContinueDragHandler);
    private void QueryContinueDragHandler(Object source, QueryContinueDragEventArgs e)
        e.Handled = true;       
        // Check if we need to bail
        if (e.EscapePressed)
            e.Action = DragAction.Cancel;       
            return;
        // Now, default to actually having dropped
        e.Action = DragAction.Drop;
        if ((e.KeyStates & DragDropKeyStates.LeftMouseButton) != DragDropKeyStates.None)
            // Still dragging with Left Mouse Button
            e.Action = DragAction.Continue;
        else if ((e.KeyStates & DragDropKeyStates.RightMouseButton) != DragDropKeyStates.None)
            // Still dragging with Right Mouse Button
            e.Action = DragAction.Continue;

  • Select record using Right Mouse Button

    How can I use the right mouse button to select a record in a multi-record grid?
    The default bahavior for Right Button is the Popup Menu.
    null

    Have you look at how to use the "when mouse triggers" perhaps create a db object for the triggers with the action you wish it to accompolish and include them in all your forms. The help system in forms, displays examples of all triggers and some of there uses and actions.

  • I can't remove Yandex Elements from the Open menu list with right mouse button and Tools menu although I removed Yandex. I think it slows down Firefox.

    I downloaded Freeyoutube downloader from internet and somehow got yandex installed in my computer with toolbars on firefox.Despite I removed Yandex from my computer Yandex elements still stays in open menu when right mouse button clicked and in the Tools menu. I tried to uninstall Firefox, remove yandex registry from windows registry and restart computer, and then reinstall firefox, Yandex elements still hangs there. Firefox is now running very slow compared to the running before Yandex.

    hello, please try all these steps:
    # [[Reset Firefox – easily fix most problems|reset firefox]] (this will keep your bookmarks and passwords)
    # afterwards go to the firefox menu [[Image:New Fx Menu]] > addons > extensions and in case there are still extensions listed there, disable them.
    # finally run a full scan of your system with different security tools like the [http://www.malwarebytes.org/products/malwarebytes_free free version of malwarebytes] and [http://www.bleepingcomputer.com/download/adwcleaner/ adwcleaner] to make sure that adware isn't present in other places of your system as well.
    [[Troubleshoot Firefox issues caused by malware]]

  • 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)

  • 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

  • Using the right mouse button with JTables

    Hi Folks,
    Can someone describe how to allow the right mouse button to select rows in a JTable? Or can someone tell me how to access the code which is activated when the RMB is clicked on a JTable so I can copy it.
    Thanks.

    Can you attach a screenshot?
    *http://en.wikipedia.org/wiki/Screenshot
    Use a compressed image type like PNG or JPG to save the screenshot and make sure that you do not exceed the maximum file size (1 MB).
    Make sure that you do not run Firefox in full screen mode (press F11 or Fn + F11 to toggle; Mac: command+Shift+F).<br />
    If you are in full screen mode then hover the mouse to the top to make the Navigation Toolbar and Tab bar appear.<br />
    You can click the Maximize button at the top right to leave full screen mode or right click empty space on a toolbar and use "Exit Full Screen Mode" or press F11.<br />

  • [SOLVED] Thunar 1.6 doesn't drag-and-drop with the right mouse button

    Hallo all.
    It might be something I've done (though I did delete my ~/.config/Thunar directory before upgrading), but Thunar doesn't let me drag-and-drop with the right mouse button, thus stopping me from copying something instead of moving it, etc. Has anyone else had that too?
    Last edited by GordonGR (2012-12-28 14:34:20)

    Joel wrote:
    anonymous_user wrote:Is it supposed to be with the right-mouse button? I always thought drag and drop was done with the left button?
    Could be right-hand user
    Come on! Read what GordonGR wrote!
    Microsoft Windows, Nautilus, the Haiku Tracker, and probably many other file managers have a feature where, when you right-click or middle-click and drag an icon to a new location, a pop-up menu appears and asks what you'd like to do (Move, Copy, Link). I thought I used to use this feature in Thunar too but it seems to have stopped working in recent versions. Has anyone else had any experience with it?
    EDIT: Here's random blogger talking about the feature in an older version of Thunar: http://jeromeg.blog.free.fr/index.php?p … and-tricks So that's good, I wasn't just imagining the feature.
    Last edited by drcouzelis (2012-12-12 03:45:05)

  • Open file with... photoshop CS6 by clicking right mouse button..

    Hi, I want to open a jpeg Picture with photoshop CS6 by clicking right mouse button open with....photoshop. The PS wont open the Pictures but freezes. I can only close it when using ctrl alt delete. I was asked to update the Version, which I did without success. CS also told me to reset the log file, with no success too, what else can i do to have this issue fixed?

    Hi,
    In the Finder doa Get Info ona NEF file, look for Open with..., change it to PS6, click the Apply to all box.

  • Right mouse button with the trackpad

    I read that on the 17 inch MBP there's an option to imitate the right mouse button by clicking when having two fingers on the trackpad (instead of Ctrl-click). Can anybody say whether this is something unique to 17 inch MBP hardware or whether we can also get it to work on the 15.4 inch MBP's?

    Hello,
    I asked this yesterday in another thread. Can someone
    with a new 17" please check and see what version of
    OSX you have. Is it 10.4.6? Or maybe 10.4.7 which we
    could see in an update soon.
    Apple will not have updated the OS revision number for the newer systems.
    What they do, is update the "Build" of the OS version.
    For example, when the iMac G5 came out, there was a custom "Build" version released with that machine (only on that machine).
    Then, when the second version and 3rd versions were released, they again released custom build revisions for those machines.
    These custom "builds" are essentially the latest OS available with a couple of tweaks to enable new features unique to that machine.
    So, what they would see is a different "Build" number than the build number on the 15-inch systems.
    This number can be found by clicking on "About this Mac" in the Apple Menu. Then, click once on the "Version 10.4.6" line where it is displayed in the box. The "Version 10.4.6" line will then change to a line that reads "Build XXXXX". On my Mac Mini with the retail 10.4.6 installed, it says "Build 8I127".
    Clicking on the build number will then display your computer's serial number. Clicking on the serial number will then switch back to displaying Version 10.4.6.
    This Build number will likely be different on machines released after 10.4.6 was available to reflect customizations to 10.4.6 that are unique to that machine.
    Keep in mind that the build number also changes with each update to OS 10.4.x that you install using software update. So, this build number will only be helpful if you check it before any updates are applied.

  • Right Mouse Button Menu Activation over JTextArea

    Hello JavaMasters !!
    I'm a little Shamy to ask you this silly question, but I don't manage to activate the right mouse button Menu over a JTextArea (to do Copy/Cut/Paste/Select All .. operations) as with a simple TextArea !!
    I hope that its just a boolean to change, and not a remake of the Menus with Panels and Images . . .
    I ve tried to Flew over Tutorials but nothing seems to be easily makabel. So if you have a solution , Easy or Hard, Please HELP ME !!
    I ll give to the winner a nice Artistic Picture of "Donna Summer" caming from my creations ! !!!
    THANKSSSSSS a lout! !

    There's a nice section in the tutorial.
    That's where I learned doing popups...
    Bringing Up a Popup Menu

  • The multi level "isolation mode" don't work after the last upgrading to Illustrator CC 18.1.0? by the right mouse button menu

    PROVA

    Yes, I know that, but I ever work with the right mouse button,
    because selecting groups and subgroups with double click make some confusion for me.
    Regards,
    Fabio
    ufficio tecnico
    grafica e prestampa
    Via Verdi, 11 - 43058 Sorbolo (PR)
    Tel. 0521.694111 - Fax 0521.694360
    E-mail: [email protected] <mailto:[email protected]>
    E-mail: [email protected] <mailto:[email protected]>
    Web: www.litoexpress.it <http://www.litoexpress.it/>
    Il giorno 28/ott/2014, alle ore 06:57, Satinder S Bains <[email protected]> ha scritto:
    The multi level "isolation mode" don't work after the last upgrading to Illustrator CC 18.1.0? by the right mouse button menu
    created by Satinder S Bains <https://forums.adobe.com/people/SatinderSBains> in Illustrator - View the full discussion <https://forums.adobe.com/message/6874053#6874053>
    You can double click on the selected object to get into the multilevel isolation mode.
    Regards,
    Satinder
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at https://forums.adobe.com/message/6874053#6874053
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Illustrator by email <mailto:[email protected]m> or at Adobe Community <https://forums.adobe.com/choose-container.jspa?contentType=1&containerType=14&container=33 67>
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0 <http://forums.adobe.com/thread/416458?tstart=0>.

  • How to get a node  in a Jtree on which right mouse button is clicked

    I am dealing with a situation in which whenever tree component is clicked by right mouse button I am needed to get the tree node on which right mouse button was clicked.

    MouseEvent e = ...
    TreePath path = tree.getPathForLocation(e.getX(), e.getY());
    Object nodeClickedOn = path.getLastPathComponent();Or something along those lines.

  • When using the right mouse button in Yahoo mail inbox (Firefox 8.0.1, Win 7, Yahoo Mail Plus) the Firefox navigation window (Back, Forward etc...) is on top of the Yahoo email menu (Open, Print, Reply etc...). This happens in Firefox safe mode as well.

    This also happened in Windows XP which I was using until recently.
    The Yahoo mail menu is there but the Firefox menu is on top of it. I tried Firefox safe mode with everything disabled and the problem still happened. I tried Yahoo mail in IE 9 and the right mouse button works correctly.

    Can you attach a screenshot?
    *http://en.wikipedia.org/wiki/Screenshot
    Use a compressed image type like PNG or JPG to save the screenshot and make sure that you do not exceed the maximum file size (1 MB).
    Make sure that you do not run Firefox in full screen mode (press F11 or Fn + F11 to toggle; Mac: command+Shift+F).<br />
    If you are in full screen mode then hover the mouse to the top to make the Navigation Toolbar and Tab bar appear.<br />
    You can click the Maximize button at the top right to leave full screen mode or right click empty space on a toolbar and use "Exit Full Screen Mode" or press F11.<br />

  • I can not open the bookmarks tab or use the right mouse button in firefox

    ''locking this thread as duplicate, please continue at [https://support.mozilla.org/en-US/questions/1053467 /questions/1053467]''
    I recently downloaded firefox to my new laptop. I can not open the bookmarks tab or use any of the right mouse button options.

    Do a clean reinstall and delete the Firefox program folder before (re)installing a fresh copy of the current Firefox release.
    *Download the full Firefox installer and save the file to the desktop<br>https://www.mozilla.org/en-US/firefox/all/
    If possible uninstall your current Firefox version to cleanup the Windows registry and settings in security software.
    *Do NOT remove "personal data" when you uninstall your current Firefox version, because this will remove all profile folders and you lose personal data like bookmarks and passwords including data in profiles created by other Firefox versions.
    Remove the Firefox program folder before installing that newly downloaded copy of the Firefox installer.
    *(32 bit Windows) "C:\Program Files\Mozilla Firefox\"
    *(64 bit Windows) "C:\Program Files (x86)\Mozilla Firefox\"
    *It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
    *http://kb.mozillazine.org/Uninstalling_Firefox
    Your bookmarks and other personal data are stored in the Firefox profile folder and won't be affected by an uninstall and (re)install, but make sure NOT to remove personal data when you uninstall Firefox as that will remove all Firefox profile folders and you lose your personal data.
    If you keep having problems then also create a new profile.
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    *http://kb.mozillazine.org/Profile_backup
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Clean_reinstall

Maybe you are looking for

  • ARG! I am unable to authorize my songs!

    I am trying to authorize some music and it won't let me, it keeps saying "There was an error storing your authorization information on this computer. The required directory was not found or has a permissions error. Correct this permissions problem an

  • Paragraphs with upper titles

    I'm writing a technical information book with many tables. In fact, there is no text... I've set a hierarchical structure with numbered list from step 1 to 4. Here is the problem: When there is no content between 2 steps (2 and 3 in eg., de two title

  • How can eCATT used for testing of z program on DEV system &data on Quality?

    Hello All, Background - Custom object is (for e.g. any report program) which I want to test is present on DEV system  and required data (e.g. data that will be passed to selection screen fields of program) on Quality system. Question -How to do testi

  • Error while starting LSNRCTL

    Hi, I got following error while starting Oracle 9.2.0.4 on Solaris... Message 1053 not found; No message file for product=network, facility=TNSTNS-12541: Message 12541 not found; No message file for product=network, facility=TNS TNS-12560: Message 12

  • New file in places

    hi,guys: I tried to saved a picrure on my file but it went under places,and I cannot either open or delete the file.what should I do