I'm writing an application in Java using the Java Swing library and am looking for a functionality equivalent to these lines of code from C# using WindowsForms:
MyDialog form = new MyDialog();
form.showDialog();
if (form.DialogResult == DialogResult.OK)
doSomething();
I haven't been able to find an equivalent functionality for JFrames in Java.
The code I'm working on is the following:
LoginFrame loginFrame = new LoginFrame(CONTROLLER);
loginFrame.setVisible(true);
The previous 2 lines of code launch a log-in window where the user can input his e-mail and password. Said window displays 2 buttons: OK and CANCEL. After the window has closed, I'm interested in knowing which one of the 2 buttons the user has pressed.
What is the standard way of doing this in Java Swing with JFrames?