Announcement Announcement Module
Collapse
No announcement yet.
tinkering - firing event on tree dbl click Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment


    • #3
      Thanks Ollie, that clears it up.

      Trevor

      Comment

      Working...
      X