Results 1 to 2 of 2
- 03-22-2009, 11:08 PM #1
Member
- Join Date
- Mar 2009
- Posts
- 5
- Rep Power
- 0
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:
mCustomer.add(iCatalogue);
mBill.add(iCatalogue1);
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!
- 03-23-2009, 03:33 AM #2
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
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
-
Can we Obtain Java Source Code?
By tornado in forum New To JavaReplies: 7Last Post: 12-10-2008, 07:23 PM -
More than one KeyStroke (Shortcut) for a JMenuItem
By hannehomuth in forum Advanced JavaReplies: 0Last Post: 07-25-2008, 03:35 PM -
How to obtain ASCII code of a character
By karma in forum New To JavaReplies: 4Last Post: 07-20-2008, 02:57 AM -
How to obtain a filled and stroked GeneralPath
By Java Tip in forum java.awtReplies: 0Last Post: 06-25-2008, 10:37 AM -
How to obtain Paragraph Layout
By Java Tip in forum java.awtReplies: 0Last Post: 06-25-2008, 10:36 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks