Java error dialog
A Java dialog box is an independent sub window that is used to notice a temporary message to the user. The dialog box find its extensive application in image, directory and anything compatible with swing. Now dialog box show an error box that gives an error message or warning message.To create an error dialog box we need JOptionPane swing.
Understand with Example
In this section of the Tutorial we want to describe you a code that helps you in understanding how to create an Error dialogs box using Swing JOptionPane.For this we have a class name Errordialogs,Inside the main method we create and assign an instance of class JOptionPane to the memory. Using JOptionSwing we create a customized dialog box, support title,text,images and icon.
1)JOptionPane.showMessageDialog(object," Press Ok to exit our" + " from the error dialog box")-This return an Error dialog box with a default title and icon.
2)JOptionPane.showConfirmDialog(null."Click One", Click one,JoptionPane.YES_NO_OPTION)-This return you an optional message that can be can be ok and cancelled the message.This mean ask you a confirm question "Yes" or "No".
Errordialogs.java
|
On the execution of code ,The Program code create you an error dialog box
with a customized message on it.
Output
Download code