Here is my code in my ApplicationWindow. I have a widgetSelected happening for a bottom called "Welcome" that I want to open a new window with text, which I already have programmed.
//Welcome was clicked
mntmWelcome.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Welcome2 newWindow = new Welcome2();
newWindow.setVisible(true);
}
});
And the welcome is a JDialog
only showing some text and stuff, but when I use this the program crashes and I get
java.lang.IllegalArgumentException: defaultCloseOperation must be one of: DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, or DISPOSE_ON_CLOSE
and I have no idea where to set this, i tried within the override but the window never opens. I just want it to open and the previous window should still be there behind. How can I solve this?
Try adding this:
Please, refer to: https://chortle.ccsu.edu/java5/Notes/chap56/ch56_9.html and read this https://docs.oracle.com/javase/7/docs/api/javax/swing/WindowConstants.html.
Documentations are really useful for beginners.