Results 1 to 2 of 2
  1. #1
    Azuxard is offline Member
    Join Date
    Mar 2009
    Rep Power

    Smile How to obtain the name of the JMenuItem?

    Hi there!

    I need some help, how do I get the name of the JMenuItem that the user pressed? I've got some JMenuItems all use the same class "catalogue":
    iCatalogue = new JMenuItem(subcatalogo);
    iCatalogue1 = new JMenuItem(subcatalogo);

    But they are used on different JMenu:

    When I click on Catalogue (the submenu inside of both customer and bill) appears a new JFrame where I put some JButtons: Insert, Update... I need that when the user clicks on Insert (for instance) I need to know the name of the JMenu (if it was Customer or Bill) where the user clicked on

    In other words, I need to know the name of the JMenu where the JMenuItem was in. How can I do that?

    Since now, thanks for the help!

  2. #2
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Hong Kong
    Rep Power


    JMenu has method getPopupMenu() which return a JPopupMenu
    A JMenuItem contained in a JPopupMenu performs exactly that function

    do you have idea now?

Similar Threads

  1. Can we Obtain Java Source Code?
    By tornado in forum New To Java
    Replies: 7
    Last Post: 12-10-2008, 08:23 PM
  2. More than one KeyStroke (Shortcut) for a JMenuItem
    By hannehomuth in forum Advanced Java
    Replies: 0
    Last Post: 07-25-2008, 03:35 PM
  3. How to obtain ASCII code of a character
    By karma in forum New To Java
    Replies: 4
    Last Post: 07-20-2008, 02:57 AM
  4. How to obtain a filled and stroked GeneralPath
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-25-2008, 10:37 AM
  5. How to obtain Paragraph Layout
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-25-2008, 10:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts