• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

JFrame focus  RSS feed

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have tried to find a solution to the focus problem , but none of them seem to match my criteria.
I have 2 Jframes ,FrameA is the enquiry screen , which calls FrameB. Once FrameB is visible it should have the focus and I don't wan't FrameA to take focus , even if the mouse is clicked on it , but it should be visible, and a beep sound should come. Only when FrameB is closed FrameA should get the focus.
Now here is what I have already done,
1. requestFocus()on FrameB,
2. FocusListener and focusLost() method has requestFocus() again.
3. When calling FrameB from FrameA , on FrameA I added FrameB.requestFocus().
But none of them seem to work. Whenever I click on FrameA , it becomes active.
Can anyone give me any suggestions.
Thanx mates.
 
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Did you look at ( modal )JDialog. You can replace FrameB
with a JDialog( call setModal(true) on it. This will make
your JDialog a modal dialog )
 
Vijay Mitra
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I cannot do that with a JDialog , I have got a JTable , few buttons and many other interactions in this frame . I need the frame but having a fixed focus on it until its active.
Is it completely impossible with a JFrame ?
Thanx for your suggestion.
 
Vijay Mitra
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shankar ,
I have tried with JDialog and it seemed to work as I wanted . Thanx for the tip yaar.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!