Article View: borland.public.jbuilder.java.swing
Article #10051JTable & JPopupMenu - do not dispayed correctly
From: Kyril Matveyonok
Date: Fri, 26 Nov 1999 00:00
Date: Fri, 26 Nov 1999 00:00
33 lines
1359 bytes
1359 bytes
I whould like to display popup menu on right-click on row.
I have something like :
class MyTable extends JTable{
JPopupMenu popupMenu = new JPopupMenu("xxx");
public MyTable(){
popupMenu.add("10000000000");
popupMenu.add("20000000000");
add(popupMenu);
addMouseListener(new MouseAdapter(){
public void mouseReleased(MouseEvent me){
popupMenu.show(me.getComponent(), me.getX(), me.getY());
}
}
}
Seems event are fired and menu should be displayed. But, here is
a problem. As I see the menu is shown, but immediatelly hides. Why?
Only when I right-clicked on last column in row near the end of cell width
menu
still appear on the screen.
MyTable is inserted into JPanel wich are displayed in JScrollPane.
--
Kyril Matveyonok,
km@tts.org.by
Technical Details
Message-ID:
<81j70p$5666@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,328a93d0af5ed266,start X-Google-Attributes: gid111d45,public From: "Kyril Matveyonok" <km@tts.nsys.by> Subject: JTable & JPopupMenu - do not dispayed correctly Date: 1999/11/26 Message-ID: <81j70p$5666@forums.borland.com> X-Deja-AN: 552892393 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing