Results 1 to 3 of 3

Thread: tinkering - firing event on tree dbl click

  1. #1
    Join Date
    Sep 2004
    Posts
    4

    Default tinkering - firing event on tree dbl click

    Hi,

    I'm trying to tinker with the standalone PetClinic client sample and am at a loss as to where to start - forgive me if this is a dumb question.

    I would like a double-click on a name in the owners tree to fire a global "propertiesCommand" similar to what happens when you hit 'ALT-Enter' with an owner selected.

    In broad brush-strokes, what should I do to acheive that?

    Thanks in advance,
    Trevor

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    335

    Default

    1) Add a mouse listener to the tree.
    2) On double click event lookup the properties command
    3) If command is enabled call execute

    Code:
            tree.addMouseListener(new MouseAdapter() {
                public void mouseClicked(MouseEvent e) {
                    if (e.getClickCount() == 2
                            && e.getButton() == MouseEvent.BUTTON1) {
                        ActionCommand command = getCommandManager()
                                .getActionCommand(GlobalCommandIds.PROPERTIES);
                        if (command.isEnabled()) {
                            command.execute();
                        }
                    }
                }
            });

    Ollie

  3. #3
    Join Date
    Sep 2004
    Posts
    4

    Default

    Thanks Ollie, that clears it up.

    Trevor

Similar Threads

  1. Replies: 11
    Last Post: Jun 1st, 2006, 04:30 PM
  2. after login redirects incorrectly
    By ryan.tyer in forum Security
    Replies: 1
    Last Post: Oct 10th, 2005, 05:16 PM
  3. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  4. Replies: 4
    Last Post: May 29th, 2005, 07:39 AM
  5. Replies: 0
    Last Post: Aug 31st, 2004, 12:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •