• Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing modal forms

 
Dave Brown
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • 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.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • 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)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!