I have a short code, I would like to open a dialog, but I do not want the user to be able to close it, it just does not work, help me.
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 what my code looks like now, I'm using Jdialog instead of Joptionpane, do I have to write more characters for the website to accept my editing?
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();
}
}
source
share