• 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

two jpopupmenus associates with two differents components

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi atm i can show one jpopupmenu for one component

but i would like to know (whats the function or a sample code will do)
how to assciate two differents jpopupmenus with two differents components
like one jpopupmenu will be associate with the jtextpane and the other one with the jtextfield

thank for the help in advance

i search for this but i found nothing good yet
i thought that the setInheritsPopup funtion would do the job but thats not what im looking for
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> hi atm i can show one jpopupmenu for one component

if you're using a mouseListener to trigger your popup.
simple use the event.getSource() to get the component,
then instanceof to see if a JTextPane of a JTextField
 
nic den
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank for the reply

yeah i should have think about this but i didnt lol
im use to do event.getsource() with actionlistener but i never done it with a mouselistener()
now its more clear how to do this

thank again michael

here is the solution :

 
reply
    Bookmark Topic Watch Topic
  • New Topic