• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

JMenuBar Question

Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 15304
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic