Article View: borland.public.jbuilder.java.api
Article #2236Re: Popup Menu AWT
From: IngPeWoerner
Date: Wed, 02 May 2001 13:18
Date: Wed, 02 May 2001 13:18
70 lines
3000 bytes
3000 bytes
Hi Torsten,
tnx for your reply.
*******
This is the source code extract:
void panel1_mouseReleased(MouseEvent e)
{
// this works great!!
// jPopupMenu1.show(e.getComponent(), e.getX() , e.getY() );
try
{
// this does not!!
java.lang.Object pnl;
pnl = e.getComponent() ;
popupMenu1.show(e.getComponent(), e.getX() , e.getY() );
}
catch (Exception e2)
{
e2.printStackTrace();
}
}
}
******
Here is the stack frame:
java.lang.NullPointerException: parent is null
at java.awt.PopupMenu.show(PopupMenu.java:107)
at testapp1.Frame1.panel1_mouseReleased(Frame1.java:258)
at testapp1.Frame1$9.mouseReleased(Frame1.java:165)
at java.awt.Component.processMouseEvent(Component.java:3717)
at java.awt.Component.processEvent(Component.java:3546) at
java.awt.Container.processEvent(Container.java:1164)
at java.awt.Component.dispatchEventImpl(Component.java:2595)
at java.awt.Container.dispatchEventImpl(Container.java:1213) at
java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)
TIA for any light into this mystery (at least to me)
Peter
"Torsten Welches" <torsten.welches@who.cares.netcologne.de> schrieb im
Newsbeitrag news:3ae7de17$1_2@dnews...
>
> Peter,
>
> please post the NullPointerException's stack trace and probably
> some lines of your code.
> Can you provide a small example that reproduces the problem?
>
> Torsten
>
> "IngPeWoerner" <IngPeWoerner@compuserve.de> wrote:
> >I am having a lot of trouble trying to get a popup menu (AWT) working.
> >The Swing popups work fine, but the AWT popup methog Show(...)
> >throws an execption (NullPointerException) although I am using the
> >same parameters as with the swing popup and the component calling the
> >popup (Panel -> MouseRelease...) is definitely not empty..
>
Technical Details
Message-ID:
<3af008e6_2@dnews>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3ae7c4d9_1@dnews> <3ae7de17$1_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,225c213336d9ac0c X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2001-05-02 06:30:02 PST From: "IngPeWoerner" <IngPeWoerner@compuserve.de> Newsgroups: borland.public.jbuilder.java.api References: <3ae7c4d9_1@dnews> <3ae7de17$1_2@dnews> Subject: Re: Popup Menu AWT Date: Wed, 2 May 2001 15:18:04 +0200 Lines: 72 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 NNTP-Posting-Host: 217.85.221.236 Message-ID: <3af008e6_2@dnews> X-Trace: dnews 988809446 217.85.221.236 (2 May 2001 06:17:26 -0700) Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews