Article View: borland.public.jbuilder.java.swing
Article #685JTable & Popup Menu
From: Erica Wheatcroft
Date: Tue, 18 Jan 2005 20:39
Date: Tue, 18 Jan 2005 20:39
35 lines
1744 bytes
1744 bytes
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:
<41ed7406$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-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 111d45,3d8097fef9530864,start 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 Subject: JTable & Popup Menu Date: Tue, 18 Jan 2005 14:39:36 -0600 Lines: 37 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; Original NNTP-Posting-Host: 206.127.10.170 Message-ID: <41ed7406$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1106080774 206.127.10.170 (18 Jan 2005 12:39:34 -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