I'm new of Java and I want to do a jDialog that is opening when I push a button in the main JFrame and show a message of error in this way:
I can't put the image in another way in NetBeans? I create in the source package a directory with the image and a try much thing:
jDialog1.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
jDialog1.add(new JLabel(new ImageIcon(ImageIO.read(getClass().getResourceAsStream("/img/error_button.png")))));
jDialog1.pack();
jDialog1.setLocationByPlatform(true);
jDialog1.setVisible(true);
Is there a simple way to do this?
We can use an option pane for this. It includes its own icons according to the type of message (and look and feel).