Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.Image;
import java.net.URL;

import javax.imageio.ImageIO;
import javax.swing.JDialog;
import javax.swing.JOptionPane;

public class Main {

    public static void main(String[] args) throws Exception {
        JOptionPane jop = new JOptionPane("Message", JOptionPane.QUESTION_MESSAGE, JOptionPane.DEFAULT_OPTION);

        JDialog dialog = jop.createDialog("Dialog Title");

        Image image = ImageIO.read(new URL("http://www.java2s.com/style/download.png"));
        dialog.setIconImage(image);
        dialog.setVisible(true);
    }
}