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.