I have a short code, i would like to dispose a dialog, but don't want the user to be able to close it, it just doesnt work, help me please.
import javax.swing.*;
public class Processing extends JOptionPane{
JDialog jd;
public Processing(){
super(null, JOptionPane.DEFAULT_OPTION,
JOptionPane.INFORMATION_MESSAGE, null, new Object[]{});
Icon processPic = new ImageIcon("C:\\Users\\Judit\\Desktop\\Mesekocka3D"
+ "\\externals\\pics\\szamitas.gif");
setMessage(processPic);
jd = createDialog("Számítás");
jd.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
jd.setVisible(true);
jd.dispose();
}
}
this is how my code looks like now, I use Jdialog instead of Joptionpane, should i write more characters to make the website accept my edit?
import javax.swing.*;
public class Mifasz
{
private static class Processing extends JDialog{
public Processing(){
Icon processPic = new ImageIcon("C:\\Users\\Judit\\Desktop\\Mesekocka3D"
+ "\\externals\\pics\\szamitas.gif");
JLabel label = new JLabel(processPic);
add(label);
setTitle("Számítás");
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
setSize(400, 70);
setLocation(330, 300);
setModal(true);
setVisible(true);
dispose();
}
}
public static void main(String[] args)
{
Processing pc = new Processing();
}
}
Okay, so I've found a very easy solution: I just disable the mainframe, while processing. How to make a JFrame Modal in Swing java