This section show you how to display several types of message box. There are three types of message dialog box that you can use in your swing applications, example of each type of dialog boxes are provided here. When your run the program, it will display a frame with three buttons. Once you click on the first button then the simple message box will open which holds only "Ok" button as shown below:
If you click on the second button then the confirm dialog box will open which asks for "Ok" and "Cancel".
you click on the "Ok" button then a message dialog box will open with
message "You clicked on "Ok" button" like this
otherwise message dialog box will open with text "You clicked on "Cancel" button like this
If you click on the third button from the main window or frame then a confirm message dialog box will open with three button i.e. the "Yes", "No" and "Cancel" like the following image:
For this purposes two methods have been used:
Here is the code of the program:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.