File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes JMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JMenu" Watch "JMenu" New topic


Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
Hi i have placed a JButton and JTextField into a JMenuItem now when the menu expands i see both of them. The problem is when i hit the button i'd like the JMenu to close, does anyone knows how to force it to colapse ?

Val SCJP <BR>going for SCJD
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Val,
Have you looked into the setPopupMenuVisible method? It might be just the thing ...
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
How will i close the popup as well ? The way regular popups work when you hit an item on it it closes or you can just click else where on your frame . With my button being placed into JMenuItem with textfield hitting the JButton will not close the menu , i though of transfering the focus to someother component but it failed. I might have to redesign my approach.
subject: JMenu
It's not a secret anymore!