The example I gave is just pseudocode and it represents what I want to do.
If the list of products is empty, immediately close the jdialog, warning the user that he can't place orders because he doesn't hasn't created any products.
And my problems are:
1. this.setVisible(false) is overriden by initComponents() and the window is shown anyway. (the warning appears and so does the "Create order" dialog)
2. Using return instead of this.setVisible(false) leaves behind a 1 pixel wide windown.
EDIT: OUCH, I HADN'T REALIZED initComponents() is an autogenerated netbeans method and not something inherited from Jdialog. Consider this solved.