Instead of wasting your time to design a JFrame
just to display a error message, you can use an JOptionPane
which is by default modal:
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, "Your message goes here!","Message", JOptionPane.ERROR_MESSAGE);
}
}
P.S. Stop using Windowbuilder if you want to learn Swing.