Delete Confirmation Dialog using Java Tutorial in Netbeans IDE

0
30

Delete Confirmation Dialog using Java Tutorial in Netbeans IDE

This tutorial is all about Delete Confirmation Dialog using Java Tutorial in Netbeans IDE. In this tutorial you will learn how to display a dialog that ask a question are you sure you want to delete this item? And it has a yes or no option. This tutorial uses Button Components and Netbeans IDE. Please follow all the steps below to complete this tutorial.

Delete Confirmation using Java Tutorial in Netbeans IDE Steps

 

First create your project by clicking the file at the top and click New Project you can name your project whatever you want. After creating your project, you can now create your form by right clicking the source packages and then by clicking New – Jframe Form. And then the form is created you drag your button on your form and double click and it will create an auto generated code that handle the event click. The lasting is to copy and paste the code below inside the event function.

 

 

int des = JOptionPane.showConfirmDialog(null, “Are you sure you want to delete this item?”,”Your title”, JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);

if(des==0){

//this mean that the user click the yes option

//Put your code here that you want to execute when the user click the yes option

System.out.println(“The user clicked the yes option”);

}else{

//in this else condition this is the no option

//in this block you can leave it empty if you don’t want to display some message to user

System.out.println(“The user clicked the no option”);

}

 

[ /java]

 

Run your project and see if it works.

 

 

For questions or any other concerns or thesis/capstone creation with documentation, you can contact me through the following:

E-Mail: ryansalem221996@gmail.com

Facebook: facebook.com/RyyanSalem

Contact No.: +639098911050

Ryan A. Salem

BSIT Graduate, soon to be MIT.

Java Developer / System Developer

Related topic(s) that you make like:

1.) Automated Payroll System using Java Netbeans IDE
2.) How to use Recursion in Java Tutorial Using Netbeans IDE

Facebook Comments
(Visited 34 times, 1 visits today)

LEAVE A REPLY

Please enter your comment!
Please enter your name here