• 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

JFrame focus

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic