Return-Path: X-Original-To: apmail-pivot-user-archive@www.apache.org Delivered-To: apmail-pivot-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B368F9135 for ; Sat, 7 Jul 2012 12:57:45 +0000 (UTC) Received: (qmail 30971 invoked by uid 500); 7 Jul 2012 12:57:45 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 30935 invoked by uid 500); 7 Jul 2012 12:57:44 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 30916 invoked by uid 99); 7 Jul 2012 12:57:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Jul 2012 12:57:44 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FSL_RCVD_USER,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of brunord@gmail.com designates 74.125.82.50 as permitted sender) Received: from [74.125.82.50] (HELO mail-wg0-f50.google.com) (74.125.82.50) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Jul 2012 12:57:38 +0000 Received: by wgbds11 with SMTP id ds11so8175113wgb.7 for ; Sat, 07 Jul 2012 05:57:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=7BepQvPM2HTjx2xsPVVa6I4Xd0R/79ahb5V7fsEkcBQ=; b=RUaRw1+ns4LH5w1Oruj2I0RZ33SOM0I0QgMikHyBa6HxEZgXXcZV7fbGTT7JrROoP0 IG9EpaelgiGbgwz3yUHo1Wu3iLm9/WgKxyZNkosHA5rK8MEpvDjYNyD1SJpzv9VergyA gHtKyrjur2L7odp2hJ1TUs/Q/6zvV9COX/wL62hc2eDvmjgeYYu9MD8MOpyWjnKxlA0M u+FaTBP9aLM3TFAShbfXSJ3SzVPXS3h0nr5YhxfusG/nJN94vjZnxPNAQekBYGh2PJKw oeCqa+vhlbZ7ucW5wdwCcZxZTx9JHayY/6LTrf98HMbr4412POm6BLhq7Y4DCMNB7Ycd ixpA== Received: by 10.216.143.200 with SMTP id l50mr11540731wej.58.1341665836804; Sat, 07 Jul 2012 05:57:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.30.137 with HTTP; Sat, 7 Jul 2012 05:56:56 -0700 (PDT) In-Reply-To: References: From: Bruno Rodrigues Date: Sat, 7 Jul 2012 14:56:56 +0200 Message-ID: Subject: Re: context menu on treeNode To: user@pivot.apache.org Content-Type: multipart/alternative; boundary=0016e6dedd8c9c2bdd04c43ceb5d X-Virus-Checked: Checked by ClamAV on apache.org --0016e6dedd8c9c2bdd04c43ceb5d Content-Type: text/plain; charset=ISO-8859-1 thanks very much!! 2012/7/7 Joseph Paterson > Hi Bruno, > > You need to add implement the MenuHandler interface and set it on your > TreeView (you can just extend MenuHandler.Adapter to make your life > easier). In your configureContextMenu method, do something similar to this: > > @Override > public boolean configureContextMenu( Component component, Menu > menu, int x, int y ) > { > Menu.Section topLevelMenuSection = new Menu.Section(); > menu.getSections().add( topLevelMenuSection ); > Menu.Item menuItem = new Menu.Item( "My Menu Item "); > topLevelMenuSection.add( menuItem ); > return false; > } > > Hope this helps. > > Joseph. > > > On Thu, Jul 5, 2012 at 7:28 PM, Bruno Rodrigues wrote: > >> hello, guys! >> >> you know how to create a listener to show a menu when pressing right >> click on a tree node? my question is clear? >> I have already a listener created for a right click, doing a simple >> System.out.print(), and I dont know how to add a context menu. >> >> thanks! >> > > --0016e6dedd8c9c2bdd04c43ceb5d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable thanks very much!!

2012/7/7 Joseph Paters= on <joseph.paterson@gmail.com>
Hi Bruno,

You n= eed to add implement the MenuHandler interface and set it on your TreeView = (you can just extend MenuHandler.Adapter to make your life easier). In your= configureContextMenu method, do something similar to this:

=A0 =A0 =A0 =A0 @Override
=A0 =A0 =A0 =A0 public boolean configure= ContextMenu( Component component, Menu menu, int x, int y )
=A0 =A0 =A0 =A0 {
=A0 =A0 =A0 = =A0 =A0 =A0 Menu.Section topLevelMenuSection =3D new Menu.Section();=
=A0 =A0 =A0 =A0 =A0 =A0 menu.getSections().add( topLevelMenuSection );
=A0 =A0 =A0 =A0= =A0 =A0 Menu.Item menuItem =3D new Menu.Item( "My Menu Item ");<= /div>
=A0 =A0 =A0 =A0 =A0 =A0 topLevelMenuSection.add( menuItem );
=A0 =A0 =A0 =A0 =A0 =A0 r= eturn false;

Hope this helps.

Joseph.


On Thu, Jul 5, 2012 at 7:28 PM, Bruno Rodrigues = <brunord@gmail.co= m> wrote:
hello, guys!

you know how to create a listener to show a menu when p= ressing right click on a tree node? my question is clear?
I have already= a listener created for a right click, doing a simple System.out.print(), a= nd I dont know how to add a context menu.

thanks!


--0016e6dedd8c9c2bdd04c43ceb5d--