Article View: borland.public.jbuilder.java.swing
Article #9181Re: JPopupMenu
From: Joe Dorman
Date: Wed, 10 May 2000 00:00
Date: Wed, 10 May 2000 00:00
63 lines
2297 bytes
2297 bytes
I don't have a solution for you but I can tell you that you don't get any of
this behavior by default.
Hopefully someone can help us out with this.
JoeD
"Andreas Andersson" <andreas.andersson@medicinsklogik.se> wrote in message
news:3916a795@dnews...
> 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:
<8fbo7h$1qt3@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3916a795@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,c8bef6409065404d X-Google-Attributes: gid111d45,public From: "Joe Dorman" <dorman@texoma.net> Subject: Re: JPopupMenu Date: 2000/05/10 Message-ID: <8fbo7h$1qt3@bornews.borland.com> X-Deja-AN: 621570460 References: <3916a795@dnews> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing