I could not see the icon with those lines of codes, although it should work. The code is the following:
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
public class IconOfDialog {
public static void main(String[] args) {
ImageIcon orignalIcon = new ImageIcon("/Images/icons8-ok-100.png");
Image iconImage = orignalIcon.getImage().getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH);
ImageIcon okIcon = new ImageIcon(iconImage);
JOptionPane.showConfirmDialog(null, "Successfully connect to the database",
"Successful Connection", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, okIcon);
}
}
Result with no exceptions: