🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #686

Re: JTable & Popup Menu

#686
From: Erica Wheatcroft
Date: Tue, 18 Jan 2005 20:42
64 lines
2414 bytes
Sorry the code is wrong it should read the following:

 in jninit()
>
>    table.addMouseListener(new MouseAdapter()
>   {
>     public void mouseReleased(MouseEvent e)
>     {
>       editTable(e);
>     }
>   });
>
> ...
>
> private void editTable(MouseEvent e)
>  {
>    if(e.isPopupTrigger())
>    {
>      table.setEditingRow(table.rowAtPoint(e.getPoint()));
>      popupMenu.show(e.getComponent(), e.getX(), e.getY());
>    }
> }



"Erica Wheatcroft" <erica.wheatcroft@gmail.com> wrote in message 
news:41ed7406$1@newsgroups.borland.com...
> Hi -
>
> I have a JTable that I have created and what to have a popup menu
> appear when the user right clicks on a row in the table
>
> so i wrote the following code:
>
> in jninit()
>
>    table.addMouseListener(new MouseAdapter()
>   {
>     public void mouseReleased(MouseEvent e)
>     {
>       editTable(e);
>     }
>   });
>
> ...
>
> private void editTable_MouseReleased(MouseEvent e)
>  {
>    if(e.isPopupTrigger())
>    {
> 
> _enumMembersTable.setEditingRow(_enumMembersTable.rowAtPoint(e.getPoint()));
>      _membersPopupMenu.show(e.getComponent(), e.getX(), e.getY());
>    }
> }
>
> However when i run the app and try to right click on a row the row is
> never selected. I have simular code for a jlist and it works great. What 
> am i missing?
>
> Thanks in advance.
>
> Erica
> 
Technical Details
Message-ID: <41ed74a2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41ed7406$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,3d8097fef9530864
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Erica Wheatcroft" <erica.wheatcroft@gmail.com>
From: "Erica Wheatcroft" <erica.wheatcroft@gmail.com>
Newsgroups: borland.public.jbuilder.java.swing
References: <41ed7406$1@newsgroups.borland.com>
Subject: Re: JTable & Popup Menu
Date: Tue, 18 Jan 2005 14:42:11 -0600
Lines: 66
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 206.127.10.170
Message-ID: <41ed74a2$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1106080930 206.127.10.170 (18 Jan 2005 12:42:10 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail