Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

How to pop up a JFrame on top of another JFrame ?  RSS feed

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone.

I have two JFrames, FrameA and FrameB. I want to make the other FrameB to pop up infront of FrameA such that the user will not be able to click on FrameA.
What I do currently I disable FrameA when a user takes some action, the only way to enable FrameA is to close FrameB.
My problem is that a user can still click on FrameA even though nothing happens until the user closes FrameB.

I want my FrameB to pop up like a JOptionPane Message Dialog, right at the center of FrameA and to force users to close FrameB before they can click on FrameA.
 
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use JOptionPane itself? The showXXXDialog accepts objects as messages. You can get the content pane's contents of frame B, pass it as message to the JOptionPane and call the required showXXX method.
 
Sheriff
Posts: 21421
94
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change FrameB into a modal JDialog. You shouldn't change anything except for the class you extend and the constructor; JFrame and JDialog are very much alike.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!