• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Popup menu not responding with mouse event

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have added popupmenu to the applet...based on the menu selected methods 'll be
called..now the problem is,for all menu selection only a particular method is called..can anyone
say me where i'm going wrong..
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some pointers:
You should be adding the mouse listener to the panel, not to the popup and menu items.
If you are using JDK1.5+ take a look at JComponent#setComponentPopupMenu()
You should check for isPopupTrigger on mousePressed AND mouseReleased(Check out the API documentation) Please note a mouseClick=mousePress+mouseRelease.
I dont see any code which checks which menu/item was selected
You subclass AbstractAction and add it directly to the popup to eliminate the if/else looks for checking which menu/item was selected
 
priya gnana
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


if(MonthlyView.contains(p))
{
monthly_view =true;
repaint();
}
else if(fitAll.contains(p))
{
fit_all = true;
repaint();
}



i have mention the menu selection in mouse pressed method.
 
Trust God, but always tether your camel... to this tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic