Java error icon
JOptionPane
's icon
support specify icon to which the dialog displays. We can use four standard icon
using JOptionPane
icons like question, information, warning,
and error). Each icon have different look and feel and have its own
versions of the four standard icons. The following given example shows you
the icons used in the Windows in java ..
In this Tutorial we want to describe you a code that explains you in understanding an error icon. For this we have a class name java error icon. Inside the main method we assign a memory to the instance of JOptionalPane swing. The JOptionalPaneswing help us in implementation of a customized icon,image,dialog box etc.
1)JOptionPane.showMessageDialog(null,"Error dialog box Demo"," ".JOptionPane.ERROR_MESSAGE)-This return you an customized Title and an error icon.
javaerroricon.java
import javax.swing.JOptionPane; import javax.swing.JPanel; public class javaerroricon extends JPanel{ public static void main(String[] args) { JOptionPane jop = new JOptionPane(); JOptionPane.showMessageDialog(null, "Error dialog box Demo", "", JOptionPane.ERROR_MESSAGE); } } |
On execution of the above preceding code ,this will show you an error icon.
Output