JDialog

I want to use JDialog box to accept id and password.And when the user clicks the ok button then it should close the JDialog box and return back to my main frame and should perform validation.How do I do that
[228 byte] By [Siriyaa] at [2007-11-26 22:01:35]
# 1

Work from the top down. You need a dialog with an API sort of like this:

MyInputDialog dlg = new MyInputDialog();

dlg.setVisible(true);

String id = dlg.getId();

String password = dlg.getPassword();

if (id == null || password == null) {

// User cancelled

} else {

// Process id & password

}

So create a class that extends JDialog and implements the API and behavior you need.

BinaryDigita at 2007-7-10 10:41:45 > top of Java-index,Desktop,Core GUI APIs...
# 2
and make a dialog modal so the main program waits until it is closed before querying for id and password
hellbindera at 2007-7-10 10:41:45 > top of Java-index,Desktop,Core GUI APIs...