File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes JMenuBar Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JMenuBar Question" Watch "JMenuBar Question" New topic
Author

JMenuBar Question

Sri Rangan
Ranch Hand

Joined: Dec 08, 2001
Posts: 160
In a JInternalFrame, I have a JMenubar, JToolbar,JTable and other components.
When the JTable loose focus i am supposed to validate the data in the JTable.
It works fine when I clicks on the JToolbar (Focus from JTable is lost). But when I click on the JMenubar, the focus is not loosing.
I tried setFocusable(true) for my JMenubar and jMenu and JMenuBar. but it does not work
Thanks
Sri
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

I am just going to guess here, but I think it may be because you set the MenuBar for the InternalFrame where as you set the ToolBar on the contentPane or JPanel of the InternalFrame. I think that when you are in the JTable and then click the JMenuBar the Focus is never technically "lost" from the JTable. This happens because there are times when you want a menu action to be performed on the currently focused component. For example, if you wanted to select a Cell and then do a copy and paste function, you wouldn't want to lose focus of the Cell when you clicked the Menu Options to perform your action.
I know this is not a solution to your problem, but I think is has something to do with that. Maybe someone else can reiterate a more intelligent response than this.
[ September 23, 2002: Message edited by: Gregg Bolinger ]

GenRocket - A Test Data Generation Platform
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JMenuBar Question
 
Similar Threads
JTable
jtable
JTable
JTABLE PROBLEM
JTable