Show Message and Confirm Dialog Box - Swing Dialogs
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
dialog box will open with text "You clicked on "Cancel" button
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:
Above method shows a simple message dialog box which holds only one button
i.e. "Ok" button. This method takes four arguments in which, first
is the parent object name, second is the message as string, third is the title of the message dialog box as
string and the last is the type of the message dialog box.
Above method asks from the user by displaying a message dialog box which
contains more than one button. Depending on the parameter passed it can be
"Cancel" or "Yes", "No" and
"Cancel". This method returns the integer value.
February 11, 2012
I am doing a project "MARKETING DAY PLANNER" in JAVA using MySQL and my module is "CUSTOMER CONTACT LIST" for that i can able to insert the customer details in the output screen but , i dont know how to save the details to the database and how to view that details...PLEASE HELP ME... TO COMPLETE...
June 21, 2012
label in main window
sir how to add label in the 1st dialog box that appears with the buttons.....can u plzz tell\\
September 17, 2012
when we using java in netbeans ,bt we can do this all pgm in ecllipse
June 4, 2014
Java GUI programming
I am new to Java. I wanna ask which technoque I can use to master the GUI section. I am well off in other sections of Java.