Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Two windows get focus in turn depends on user action?

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am doing a GUI project using SWING, there is a requirement that I am not sure if can be done by swing.

1. When the application start, the main window appears but kind of grey out, on top of the main window there is another small log in window for user to input user name and password, after the user input info and submit it and validation (using web service) is passed, then the login window disappear and the main window become the focus. On main window, there is log out button, when the button is clicked, the main window is grey out again and log in window appear on top of main window.

How to accomplish this if it can be done? I checked online ( http://java.sun.com/docs/books/tutorial/ui/features/compWin.html ) , is the internal frame the only way to do this? How to do it?

Thanks.

 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you need is a modal window (modal indicates that the user cannot interact with the main window until the operations of the child window are done)
Check out the JOptionPane class. It has several convenient methods called showXXXDialog which you can use to display a modal dialog.

As for the graying out part, I personally feel you are thinking on the lines of a web based browser application. In my opinion the graying is not required in a stand alone application. However, if you still wish to have it, check out JFrame#setGlassPane.
 
david arnold
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it, thank you Maneesh very much for your kind help!

Regards.
 
We're being followed by intergalactic spies! Quick! Take this tiny ad!
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic