This tutorial is all about How to use Radio Button in Java Tutorial using NetBeans IDE. In this tutorial you will learn how to insert a value in database using radio button. Radio Button is very useful when it comes to data registration, because radio button can be use in a field of gender or sex. It will help you identify if that person is a he or she. This tutorial uses radio button and NetBeans IDE. Please follow all the steps below to complete this tutorial.
How to use Radio Button in Java Tutorial using NetBeans IDE steps
The first step is to
Create your project by clicking file at the top of your project and then click new project, you can name your project whatever you want. After creating a project, the default form will be created automatically. and now the next step is to drag two radio buttons in this example I use radio button based on gender.
After dragging the two radio button rename it as Male and the other one is Female.
And then go to your code and create a gender variable, after creating the variable go to your gui and double click each radio button. Like for example when you double click the male radio button you will assign a value to a gender variable to gender=” Male” otherwise its gender=” Female”
String sql = “INSERT INTO users (first name, last name, gender) VALUES (?,?,?)”;
pst = conn.prepareStatement(sql);
JOptionPane.showMessageDialog(null, “User has been added!”);
JOptionPane.showMessageDialog(null , e);
Then you’re done. Run your project and see if it works.
About How to use Radio Button In Java
|Project Name:||How to use Radio Button|
For questions or any other concerns or thesis/capstone creation with documentation, you can contact me through the following:
E-Mail: [email protected]
Contact No.: +639098911050
Ryan A. Salem
BSIT Graduate, soon to be MIT.
Java Developer / System Developer
Related topic(s) that you make like: