Right click select node in tree (for a standalone Air app)?

For the sake of userfriendliness (in regard to a context menu) I wold like to "move" the selected node in a tree to the node that currently has the focus when right clicking it - like how the context menu access in windows file explorer works (focus and selected item are always the same  when right clicking).
In worst case scenario I would like to disable a created context menu if the selected node and the node that currently has the focus are not the same).
Now users can get confused when right clicking to access my context menu, in the tree structure, if the selected node and the node they are currently hovering over (and thus are in focus) are different.
I was thinking of finding which node currently has the focus and then making that node the selected node - but I cant get it to work:-).
Please, help a beginner.

Hi,
Duplicate thread of
http://swforum.sun.com/jive/thread.jspa?threadID=64518
MJ

Similar Messages

  • Allow right-click selection in a JTree

    Hi everybody! How are today? Fine? I hope so.
    I've got a little question about JTrees: i want to put a right-click popup menu on my JTree, which may not be the same depending on which node of the tree is selected.
    My problem is that i must do a left click selection of the node before doing the right click in order that this one may be effective and correct (i.e the correct popup menu appears).
    So, i want to allow the right click selection in my JTree to select the node and to perform the action linked to the Popup menu.
    I will be very thankfull if someone could help me :)

    Sorry to post twice, but just thought i'd post the code to show you what I mean (forgive me not making this entirely generic):
    ///// Some "global" variables:
         private JPopupMenu               stPopupMenu;
         private TreePath               stPath;
         private String                    stPathComponent;
         private int                         stCount;
         private Object                    selectedNode;
    ///// Attaching the listeners:
    symbolTreeDisplay.addTreeSelectionListener(stHandler);
    symbolTreeDisplay.addMouseListener(stHandler);
    //// The event listener class:
         private class SymbolTreeHandler extends MouseAdapter implements
                   TreeSelectionListener
              public void mouseClicked(java.awt.event.MouseEvent event)
                   try
                        if (event.getModifiers() == event.BUTTON3_MASK)
                        {//right button click on mouse
                             stPopupMenu = new JPopupMenu();
                             // add your logic here, based on selectedNode to add items to the menu
                             stPopupMenu.show(symbolTreeDisplay, event.getX(), event
                                       .getY());
                   catch (Exception e)
              public void valueChanged(TreeSelectionEvent aTreeEvent)
                   try
                        stPath = aTreeEvent.getPath();
                        stCount = stPath.getPathCount();
                        selectedNode = stPath.getPathComponent(stCount - 1);
                   catch (Exception e)
         }

  • How to remove the option "Set as default background..." from the right-click menu on a picture, for all users.

    Hi! I would like to know if there is any possibility to remove the option "Set as default background..." from the right-click menu on a picture, for all users. I know that's possible to edit userContent.css or userChrome.css, but this concerns only a profile at a time and being in a domain, I would like to set this for all people using Firefox.
    Can it be possible to edit a mozilla.cfg file to get the same result?
    Thank you in advance for help and tips.

    AFAIK then there is no way to do that system wide. You can only do that via userChrome.css or an extension like the Menu Editor per profile .You can install extensions globally, but the user will have to enable them anyway. That is not required for userChrome.css code.

  • My magic mouse behaves erratically with intermittent problems - slows down, right click doesn't work, disconnects for a few seconds then reconnects. Anyone suggest what I could do to fix this?

    My magic mouse behaves erratically with intermittent problems - slows down, right click doesn't work, disconnects for a few seconds then reconnects. Anyone suggest what I could do to fix this?

    I just figured out the print quality issue for my wife with her new iMac and new printer.
    She replaced both at once and she couldn't understand why her Artisan 730 was lower quality then her Epson R280 when they had the same specs.
    Turns out the newer printer had the option to connect via wifi which we used during setup.
    The driver options are completely different depending on how you connect.
    Once I connected via USB the correct options were available and the print quality was better.
    Looking at the R2400 it dies not have wifi, but while researching the problem for my wife someone esle was having an issue updating to the latest printer driver.
    If you go into the print utility from the Printer and Scanner system preference and under the general tab you should have driver 5.5.
    One user had to delete the old printer driver before Software Update loaded the newer printer driver.
    https://discussions.apple.com/message/15947486#15947486
    On my MacBook Pro (w Snow Leopard) I always had to reconnect my wifi at home when it woke up. I upgraded my router from an old Netgear to a newer N D-Link and stopped having to do that.
    I would be surprised you would have that problem with an Airport Extreme, you might check to see if there is a firmware update for it.

  • How to enable Fullfillment set menu in the Right click at the line level for a responsibility?, by default it comes for OM ADMIN.

    How to enable Fullfillment set menu in the Right click at the line level for a responsibility?, by default it comes for OM ADMIN.
    for this responsibility i need to have teh sets enabled. how to do teh same.
    similar to OM ADMIN as shown below:
    Kindly advice on teh steps. i believe its some menu /function inclusion can you pl share teh pointer.
    regards,
    bala

    AFAIK then there is no way to do that system wide. You can only do that via userChrome.css or an extension like the Menu Editor per profile .You can install extensions globally, but the user will have to enable them anyway. That is not required for userChrome.css code.

  • Right clicking anything in web pages (for an example, when I want to open a link in a new window) it just gives me some grey box. How do I fix this?

    Right clicking anything in web pages (for an example, when I want to open a link in a new window) it just gives me some grey box. How do I fix this?
    == This happened ==
    Every time Firefox opened
    == Today

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]

  • Is there any way to disable right click and drag and drop for photos on iweb?

    Re: protecting photos when using iweb as your web designer...
    Is there any way to disable right click and drag and drop for photos using iweb?  I have seen tutorials about creating a text box around each image - but is there a better way? 

    However, there is no way you can prevent someone from making a screenshot of the image as it is displayed on the screen no matter what application you use to create the web page.
    You can add a watermark to dissuade the casual "thief" but those who are serious about stealing the photo for their own use can remove the watermark with some effort.
    OT

  • Save selected node in Tree control

    I'm making this flex form for my school to add a new student
    to the DB. When the admin clicks on a button it will open a Tree
    control that displays the available courses and sections in the
    following heirarchy:
    Year>Semester>Course Name>Sections
    Now I want that when he clicks on the button Select within
    this new window showing the Tree, it will store the current
    selected node and the full path to it, so that back in the original
    form it will display the Year, Semester, Course name and section.
    I've tried using the value and selecteditem methods from the tree
    control but they are not working. Any ideas to figure out the full
    path of the selected item?

    You will need to climb back up the ancestor nodes to build
    that path yourself.
    "parent()" i believe returns the parent of the current node.
    Tracy

  • Highlight selected node in tree

    I have a tree in the left, representing my company´s departments structure and in the right, when clicked, I show the employees that are subject to that department.
    I´ve noticed there´s no visual nor code (id, class, nothing) difference between the currently selected node of a tree and the others.
    There´s a way to do that? I thought about using js, but the only way a see to do that is using a regex in the link text of that node, comparing to the variable that that was passed to the page.
    Someone?
    Thanks

    Trees currently don’t have a concept of a “current” node. You could try using lists instead; though they won’t be query based, they would have to have static values. And in the current 1.6 version you can’t have hierarchical lists, though that will be added in 2.0.
    Marc

  • Right click selection issue

    I am using HP Laptop with window 8.1.
    The right click button on the keyboard is not available so till the time I was using mouse for the right click.
    Now I install Hotkeys software & configure right Alt button of the keyboard as a right click button.
    It is working fine means whenever I clicked on the right Alt it is working as a right click, this is helpful in excel specially.
    But after this I am facing a new issue, this issue is when I using excel or word.
    When I move the cursor & select any cell with the mouse & then click on right alt it work properly.
    But after the selection from the mouse if I change the location by using arrow keys of the keyboard the location get changed but after changing the selection when I click on right Alt button the right click options open for the cell which was selected by
    the mouse.
    Hope it is clear.
    Example- If I select A5 location in excel by mouse & then goes right with keyboard right click on C5 location, the selection goes to the desired location, but if now I click on right Alt to open the options the cursor automatically opened the properties
    of A5 instead of C5.
    Here I clicked by mouse on A5 & moves to C5 by keyboard.
    Please help.
    This is  not an issue of scroll lock.

    I am using HP Laptop with window 8.1.
    The right click button on the keyboard is not available so till the time I was using mouse for the right click.
    Now I install Hotkeys software & configure right Alt button of the keyboard as a right click button.
    It is working fine means whenever I clicked on the right Alt it is working as a right click, this is helpful in excel specially.
    But after this I am facing a new issue, this issue is when I using excel or word.
    When I move the cursor & select any cell with the mouse & then click on right alt it work properly.
    But after the selection from the mouse if I change the location by using arrow keys of the keyboard the location get changed but after changing the selection when I click on right Alt button the right click options open for the cell which was selected by
    the mouse.
    Hope it is clear.
    Example- If I select A5 location in excel by mouse & then goes right with keyboard right click on C5 location, the selection goes to the desired location, but if now I click on right Alt to open the options the cursor automatically opened the properties
    of A5 instead of C5.
    Here I clicked by mouse on A5 & moves to C5 by keyboard.
    Please help.
    This is  not an issue of scroll lock.

  • Selecting node of tree

    Hello thanks for anyone before..
    I have a problem with selection of my Tree. my tree nodes contains of ItemFormat like :
    class ItemFormat
    private String code;
    private String description;
    ..... mutator and accessor methods......
    when i have displayed my tree successfully i can print on screen about selected itemFormat to display description instance variable.
    but after I edit my node and then i selected again the selected node can't be casted to ItemFormat to display its description...
    please help me...
    thanks before....

    Thanks Tony,
    The application I have is a means of commercial seafood dealers recording what species they have purchased/landed. The page is designed with a tree listing all of the species and their sizes and then the tabular report of landings. The current application uses a collection to display the landings....I was trying to get rid of the collection and populate the table directly.
    thanks for getting back to me. Sounds like I will need to keep the collection....just looking for examples.

  • Bug in right click selection in reports

    Build 22.71, on Linux and Windows.
    When I go to, for example, the sessions report, and right click on a row which I want to invoke a trace session command on, the whole column where I right clicked get selected, so it does not correctly indicate to the user which session will have trace enabled on.

    Add mouselistener:
    MouseListener ml = new MouseAdapter() {
          public void mousePressed(MouseEvent e) {
             if (SwingUtilities.isRightMouseButton(e)) {
               doSomething();
          }//mousePressed
          public void mouseReleased(MouseEvent e) {
            if (SwingUtilities.isRightMouseButton(e)) {
              doSometing();
          }//mouseReleased
        };//mouseListener
        myList.addMouseListener(ml);

  • Right clicking selection gives nothing

    So to make this short, I can use the pen tool to create a shape, then by right clicking it I can decide what I want to do with it. When I click "Make selection" I've selected the shape, but when I right click it again in order to find out what I want to do with that shape, it doesn't let me do anything. Everything grayed out. Normally I'd have the option to copy to layer or copy to cut but nothing.
    Looks like this

    I can see that you have made a shape with the Pen tool.  You have right clicked and cosen Selection, but you must have specified a high Feather value because the selection only covers a small part of the shape, (the matching ants indicate 50% opacity). 
    From there, you would take other routes to achieve what you mention.  Ctrl j would copt the selection to a new layer, for instance, but that layer will have a heavily feathered outline.   You should still have some options if you right click again, but useful as right clicking can be, it doesn't cover everything.

  • Auto scrolling to a selected node in Tree

    Hi All,
    In my one of my flex application, i am selected nodes in a tree based on some input. However, if my tree is large and the selected node is at the bottom then i cant see what is selected until i scroll down. Is there any automatic way of scrolling to a node when that node is selected?
    Thanks.

    I have tried the following, but it is not working.
    Tree.scrollToIndex(Tree.selectedIndex);
    Any idea?

  • Right-click/select on trackpad not working

    Hi
    Basically the "right click" option on my trackpad has stopped working, I can't highlight sections of text or images, can't click and drag any items and can't resize windows or images. I'm going crazy does anyone know what's wrong? I called Apple and they didn't really help with anything, I've reset my preferences to default but no luck!
    I can scroll with two/three/four fingers fine it's just when I want to click with two that nothing happens.
    Any help would be greatly appreciated!
    Alyssa

    01/04/14 Update:  I've updated all SW (BIOS, UltraNav Driver and Utility, latest Win7 updates) but right button still won't work.  Ran the PC Doctor diags for the UltraNav and it shows the right button highlighted constantly (as opposed to it blinking on/off when button is processed like the the left button does).

Maybe you are looking for

  • Can not archive PO?

    Hi Experts, I trying to archive PO but I couldn't create archive file,the steps that I following is as below: 1- Tcode SARA 2- Archiving Object:MM_EKKO 3- Write archive 4- Maintain varainat the same as variant  in customizing (Archiving Object Specif

  • Button Save layout not appearing in the Applicaion toolbar

    I am displaying an ALV output thru OOPS like   my_salv_table->set_screen_status(     pfstatus      =  l_pfstatus     report        =  my_repid     set_functions = my_salv_table->c_functions_all ). I have set my pfstatus prior to this . In my PF statu

  • Exchange 2013 OOF not working for migrated accounts

    We are having a problem with the Out of Office responses in Exchange 2013.  We are getting the error "Your automatic reply settings cannot be displayed because the server is currently unavailable.  Try again later."  I have been through several help

  • Save for web & devices - Background question

    Hi, The save for web & devices option is very useful, but there's one thing that causes me a problem & I don't know whether there's an easy solution to it. Many of the transparent images I create are intended to sit across two or more background colo

  • How the PURGE INDEX command works

    Hi all,<br><br> PURGE INDEX command purges the specified index from the recyclebin.<br> My question is: I noticed that the dropped index doesn't appear in the recyclebin, so from where it could be purged?<br><br> SQL> CREATE INDEX Z_IND ON Z (Z); Ind