Article View: borland.public.jbuilder.java.swing
Article #9261JPopupMenu
From: Andreas Andersson
Date: Mon, 08 May 2000 00:00
Date: Mon, 08 May 2000 00:00
50 lines
1929 bytes
1929 bytes
Hi,
I'm having a problem when I try to show a JPopupMenu. I want to enable
stepping with arrows (up & down), disable popup with the escape-key and so
on...
I thought that this was implemented i L & F (Win32) for JPopupMenu, but it
doesn't work for me. The popup menu doesn't listen to keystrokes. What am I
doing wrong ???
In my implementation I try to show the popupmenu when user has right clicked
i a JTable.
Here is how I implemented my JPopupMenu:
// Popup menu
protected JPopupMenu m_tablePopup;
protected Action m_action;
........
void jbInit() throws Exception {
...
m_tablePopup = new JPopupMenu();
PopupAction action1 = new PopupAction(strpopup1);
PopupAction action2 = new PopupAction(strPopup2);
m_tablePopup.add(action1);
m_tablePopup.add(action2);
// Add this popup menu to a table
myTable.add(m_tablePopup);
}
// Class that takes care of Actions on PopupMenu, works fine !!
class PopupAction extends AbstractAction {
public PopupAction(String newNamedAction)
{
super(newNamedAction);
}
...... // All this works fine
}
// In another inner class..
if (me.isPopupTrigger()) // is right mousebutton ??
{
int x = me.getX();
int y = me.getY();
// Here is my problem, this PopupMenu doesn't listen to keystrokes
m_tablePopup.show(ownPatientsViewTable,x,y);
}
Can anyone help me ?
Regards
Andreas
Technical Details
Message-ID:
<3916a795@dnews>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,c8bef6409065404d,start X-Google-Attributes: gid111d45,public From: "Andreas Andersson" <andreas.andersson@medicinsklogik.se> Subject: JPopupMenu Date: 2000/05/08 Message-ID: <3916a795@dnews> X-Deja-AN: 620618678 X-Trace: 8 May 2000 04:40:05 -0800, 193.15.79.66 Organization: MLAB X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: borland.public.jbuilder.java.swing X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300