How to post an Event (mouse left click) to JTree

Hi,
I am using JTree for my application just like the windows explorer tree. By default, Jtree node will got focus using left click. But, I'd like that my tree will detect a right click so that I can copy any file to the Jtree. I've added a mouselistener to it but the node is not selected by the right click. Anyboby can teach me how to post a mouse left click event to the Jtree so that it will become selected using left click.
Thanks a million

Hi
In the class JTree there is a method getClosestPathForLocation(int, int). The parameters are the coordinates which you can get from the MouseEvent. If you have this TreePath you can select the Node.
This should solve your problem.
Regards
Dieter

Similar Messages

  • How to post an Event (mouse left click) to JTree node

    Hi,
    I am using JTree for my application just like the windows explorer tree. By default, Jtree node will got focus using left click. But, I'd like that my tree will detect a right click so that I can copy any file to the Jtree. I've added a mouselistener to it but the node is not selected by the right click. Anyboby can teach me how to post a mouse left click event to the Jtree so that it will become selected using left click.
    Thanks a million

    See if this is useful
    public void mouseClicked(MouseEvent event)
    Object object = event.getSource();
    if (object == mTree)
    mTree_mouseClicked(event);
    private void mTree_mouseClicked(MouseEvent event)
    if(event.getModifiers()==event.BUTTON3_MASK)
    //your logic goes here
    }//close method

  • Magic mouse left click works like right click

    magic mouse left click works like left click and at times right click.

    Read this: http://magicmousehelp.com/change-primary-click-magic-mouse/

  • USB Mouse Left Click not working, DV6700

    I have been using 2 hands to operate the simplist functions on my laptop.
    I move the mouse around with my right hand but if I want to click something I have to use the left button under the mouse-pad.
    HP support gave me a solution that worked for about an hour (Reset BIOS to default) .
    The right click on the mouse (ANY USB mouse) works fine. Its just the select button.
    I hate this!
    HELP!!!

    To CLARIFY:
    ANY USB Mouse that I plug into my (DV6700 HP Pavillion) Laptop--- the left click button doesnt work unless I hold it down for over a minute and move it around clicking on and off over and over. It can take 2 minutes before it actually clicks. So, I use the left button under the touch pad. That means its impossible to use this computer for games AND dragging and dropping is weird because I never got used to doing it with a touchpad.
    I doubt I will ever buy another HP because of this. I HATE IT!!!
    Other USB products act weird too.
    I have also deleted all USB components in Control Panel and had windows reinstall them with the wizard.
    It worked briefly (couple minutes) then was corrupted again.
    Am I supposed to just throw this thing away?

  • How do I fix a nonresponsive left click?

    My daughter's macbook, circa 2008, is not left clicking easily anymore. Is there a simple fix for this aside from an external mouse?  Thank you!

    Welcome to Apple Support Communities.
    You could try turning the unit off, turning it upside down and shaking it gently to see if there is anything lodged underneath the button. A blast of compressed air might also dislodge anything preventing the button from working. If that doesn't help, the external or wireless mouse is the next option. After that, a replacement trackpad/keyboard, called a 'topcase' in MacBook-speak, would be a solution.
    If the leading edges of the topcase have cracked (Apple calls it 'chipping') where they contact the edges of the top/screen when closed, you might get a free replacement topcase from an Apple Store.
    There are a number of reports in these forums where free replacements occurred, with or without extended AppleCare coverage, as well as reports where a free replacement was denied. Mine was replaced at no charge out-of-warranty about two years ago for the chipping issue, not because of any problem with the button.

  • Mac wireless mouse left click not working on macbook pro laptop

    I think I found a couple of solutions, but they have been temporary,,,,would welcome more ideas.
    it happens when I travel. when you switch Wifi connections in different locations.
    all of a sudden the left click on the mouse stops working, and you can only right click.
    these are the only things that have worked so far to correct the issue:
    rebooting (not always works)
    hitting the escape key (worked at first)
    making sure the mouse batteries are not low, and that no other track pads are interfering with it…(works sometimes)
    the last fix was right clicking on the apple and putting it to sleep.  then return by hitting escape and the problem was fixed (at least for now)
    this happens all the time now, especially when I switch wifis….
    c

    Mystery solved! The one thing I did not try was to actually print... which works! Even while the Mac OS X W-Fi icon still shows the 'connecting' animation or the 'problem' exclamation mark.
    Possibly Mac OS X just signals that the Wi-Fi does not connect to the internet or the likes. The Wi-Fi connection per se does work, also with password and with IPv6 enabled.

  • How to get the event on double click the Matrix(#)?

    There is a <b>#</b> on Matrix(0,0) in most SBO Form, I want to double click it, then it will respond with a dialog box, I don't know how to do in VB6, who have some code sample? thank you.

    Hello Adele,
       No, I did not add a breakpoink in my coding, I try to wake up the double click events, but as below sample, I also remove the <b>Case et_CLICK:</b>, could not get the double clikc event either, I don't know why?
      Select Case pVal.EventType
                '// every event will open a message box with the event
                '// name and the form UID how sent it
    <b>            Case et_CLICK:
                '// Specifies Mouse Up on editable item.
                    SBO_Application.MessageBox _
                    "An et_CLICK has been sent by a form with the unique ID: " + FormUID</b>
                Case et_DOUBLE_CLICK:
                '// Specifies Mouse Up on editable item in time interval define by
                '// SAP Business One as double-click.
                    SBO_Application.MessageBox _
                    "An et_DOUBLE_CLICK has been sent by a form with the unique ID: " + FormUID

  • HT202731 mouse left click not working

    Mouse not working properly.  Not sure if it is related to new operating system Yosemite that I downloaded but issue started after that. 
    Left mouse click either doesn't work at all, or starts working then grabs and won't release what I am clicking on.  Rt mouse click works ok.  Any others with this issue?  I have tried magic mouse and regular mouse, same issue. 

    If you go to System Preferences > Mouse & Keyboard and select the Mouse tab you'll see an option of the right side for the primary button. make sure the left is selected.

  • Magic Mouse Left Click Problem

    I got a Magic Mouse for Christmas this morning and set up with my Macbook Pro. The setup went quickly and well. I was able to move the cursor around my screen with the Magic Mouse.
    However, the click buttons don't work. I have tried left and right clicking and nothing happens.
    Is there a problem with my mouse or did I miss something in the setup?
    Thanks.

    I had the same problem this evening. Is it possible that you had your USB or trackpad mouse buttons reversed when you switched to the Bluetooth mouse?
    I normally reverse my mouse buttons (like for left handed people). My index finger naturally rests on the upper right corner of the mouse. When I try to use the normal button config, my hand and forearm fatigue in no time. Reversing the buttons allows me keep my index finger relaxed for all the normal mouse clicking, then I reach left for the "right" button.
    It also discourages others from using my computer!
    Anyhow... When I connected to the Magic Mouse, the buttons didn't work. I turned it off and connected the USB mouse, returned it to "right-handed" mode and switched back to the Magic Mouse, and the buttons work correctly now. I then use the Magic Mouse control panel to set Secondary click to left.
    Hope that helps!
    Ken

  • How to post audit event from my application ?

    Hi All,
    I'm newbie in weblogic(server) field. I'm working on audit trail for my application. We are using weblogic server8.1 SP4.
    I read thru the documentation in weblogic site and understood the default and custom auditing providers/auditing events and how to configure them from the admin console.
    I would like to know how to programatically invoke/trigger/post that audit from wherever I want from the application.
    Hope I'm clear.
    Any help in this regard is highly appreciated.
    Thanks
    Viji

    If you find out.... I'm curious too.

  • How to show tooltip on mouse right click...

    Hi everyone!
    I'm trying to show a tooltip when the user clicks on a button with the mouse right button but I'm having some problems starting, for example, with the tooltip position. For example, look at the the following example(without mouse listener yet):
    public class test extends JFrame{
         private JToolTip      jtp      = new JToolTip();
         private JButton      button      = new JButton("a button");
         private JPanel           panel      = new JPanel();
         public test(){
              add(panel);
              panel.add(button);
              jtp.setTipText("a tooltip");
              jtp.setBounds(10,10,10,10);
              jtp.setVisible(true);
              panel.add(jtp);
         public static void main(String[] args) {
              test x = new test();          
            x.setVisible(true);
    }Why the setBounds doesn't set the position? In fact it doesn't do anything.
    Is it possible to the tooltip to partially overlap the button. As far I checked they only stay side by side.
    I hope you understand my english...
    Filipe

    Use this code to show custom tool tip.
    You should also handle the hiding of the tool tip.
    JButton button = new JButton("test");
    button.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON3) {
                JButton button = (JButton) e.getSource();
                JToolTip tooltip = button.createToolTip();
                PopupFactory popupFactory = PopupFactory.getSharedInstance();
                tooltip.setTipText("a tooltip");
                final Popup tooltip1 = popupFactory.getPopup(button, tooltip,
                        button.getLocationOnScreen().x + e.getX(),
                        button.getLocationOnScreen().y + e.getY() + 20);
                tooltip1.show();                       
    });

  • Mouse left-click not working after first click

    I see this issue has been up several times. I have disabled Microsoft .NET Framework Assistant and Java Quick Starter, but still have the problem. I’m using the lastest FF ver. 3.6.6 on Win XP. I think I have had this problem once in a while since FF 3.0 but now it’s almost daily.
    Does anyone know what’s causing this?
    Thanks,
    Frank
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB6.5; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)

    I replaced my wireless mouse with a wired one, and the problem went away.

  • Any methods or interfaces for Mouse Left and Right click actions?

    Could anyone tell me the methods that I can use for setting up Mouse Left click and Mouse Right click actions? I checked the on-line API and could not find those specifications. Maybe I misses something and did not find them. If you just happen to know it, could you reply this message or you can tell me where I can search to find it. Thanks for your help. Bob

    I believe you just set up to receive all mouse click events regardless of which mouse button the user clicked. When you get the MouseEvent object, call its getModifiers method to get an indication of which mouse button was pressed. Check the javadocs for MouseEvent, paying particular attention to "the button mask in the modifer field"

  • Left click button not working on mouse

    Using an HP Pavillion g series notebook with windows 7 and all of a sudden my HP wireless mouse left click button doesn't work. checked to see if it was clean, changed the battery too.  Right click buttonis working as left click now. Driver software is upto date.  Only 2 years old with light use.  What's up?

    I also get what looks like tiny barcodes to the top right of my mouse pointer.
    That is usually a software corruption problem.
    Disk Utility ( Repair Disk ) is a good place to start.

  • How to capturing Mouse double click action?

    Hi all,
    how can we identify the "mouse double click" action?
    MouseListener has methods for only mousePressed,released,clicked (single).
    Thanks in advance..
    Regards
    Sojan

    Hi,
    Thanks it worked ..
    e.getClickCount() value increases if we keep on clicking on the component, is there anythning wrong by interpreting double click as
    "e.getClickCount() >=2 "?
    Regards
    Sojan

Maybe you are looking for

  • Can't get PPro 3 to capture from my Sony Z1U

    I have the Sony Z1u connected via the output 4 pin firewire port of my camera..but PP 'capture' window claims the camera is 'off line.' When viewing the Capture window/settings, the 'Device control' in the capture menu doesn't cover this camera. It c

  • How can i add a new count to this source code ?

    [4shared.com - document sharing - download db.txt|http://www.4shared.com/file/210566155/c080d93a/db_online.html] Hi everyone I have 5 variables 1. XTSM is between 0~200 2. XTS is between 0~2 3. XRX is 0~3 4. XHAN is 0~7 5. ZHTYPE is one of these : (1

  • Looking for a book

    Does anyone know of a book that exists that shows you how to create jsp applications for the web? Like specific step-by-step instructions? I found JRun Web Application Construction Kit, but i'm wondering if there are any others that are preferably fr

  • Adding custom buttons to crystal reports html viewer

    Hello, I'm using crystal reports for eclipse and I have a time chart in my report that is displayed with html viewer. I need a button bar to navigate on this chart e.g. the button which adds values to chart for the next month. Is it possible to add c

  • DBMS_SYSTEM Package

    Hi List, I used the DBMS_SYSTEM.SET_EV(...), for trace purposes, without any problem when I am connected as SYS. Then, I 'grant execute' on this package to another user. When I execute the same package with this user I receive an error PLS-00201 - th