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

Swing modal forms

 
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All, I'm new to swing development and have hit a stump.

Very simple app (so far) I'm attempting, a simple app which will launch a log on form, which contains a button to create a new user which in turn displays another form allowing the user to enter their own choice of ID & password.

So far I have the database side of things done, the authentication is working and the new user form allows me to create new users..

What I'm totally confused about however is the approach to displaying forms.
My Login Form's "main" function is what runs when i execute my App. When the new user button is clicked I'm simply creating an instance of the new user form ;

frmNewUser frm = new frmNewUser();
frm.setVisible(true);

What I dont know how to do is
A. Make the form behave in a modal fasion and
B. when the user creates a new user record, I need to retrieve the login ID and password from the new user form and populate the login ID & password textfields of the login form before the new user form closes.

Any suggestions appreciated,

Thankyou.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A. make the form a JDialog, modal set to true

B. this might be one approach
new user form appears (login form setVisible(false))
user enters new data (new user form dispose(), login form setVisible(true))
user logs in normally (also confirms 'just entered' data)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic