get the Dialog associated with an event

So i have a Dialog with some textfields which hold the login information to a database. I press a button called "connect" which fires an event, which then connects to the database.

I want to read the textfields within the Dialog to assemble the Connection String but i have no idea on how to get the info through the event.

So far i have extended the JDialog with some methods like getUsername() which returns fieldUsername.getText();

But how can i get the MyDialog object?

getSource() returns only the button.

getSource().getRootPane returns only the RootPane.

Or is there even a better way to exchange this information?

[665 byte] By [eversora] at [2007-11-26 14:02:30]
# 1

Normally you would define all the text fields as class variables within the dialog. Then when you click the button you access each field to make sure data has been entered. If it has you connnect to the database. If not, then you display error messages.

So basically you create a "ConnectDialog" with has all the components and code contained in one place.

camickra at 2007-7-8 1:45:12 > top of Java-index,Desktop,Core GUI APIs...