How To Create A Simple Registration Form Using Java AWT
In this program, we will learn to create a simple registration form using a java applet. This program is a simple form page where you can enter your name and select gender using the radio-button and select age then click on the button. Here you can find different options to select of age among that you can select anyone. if you want to add more option so you can add in code
if you click on the button then name, gender and age will be displayed below.
if you click on the button then name, gender and age will be displayed below.
Source Code for user registration form:
lower = int(input("enter lower range:"))
higher = int(input("enter higher range:"))
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/* <applet code="LoginName.class" height=1000 width=1000></applet>*/
public class LoginName extends Applet implements ActionListener
{
String name=" ", gender=" ";
int age;
TextField n=new TextField(10);
CheckboxGroup g=new CheckboxGroup();
Checkbox m=new Checkbox("male",g,true);
Checkbox f=new Checkbox("female",g,false);
Choice c=new Choice();
Label l1=new Label("Enter name:");
Label l2=new Label("Selec Gender:");
Label l3=new Label("age:");
Button b=new Button("Button");
public void init()
{
b.setBackground(Color.red);
c.setBackground(Color.red);
setBackground(Color.black);
setForeground(Color.white);
add(l1);
add(n);
add(l2);
add(m);
add(f);
add(l3);
c.add("10");
c.add("15");
c.add("20");
c.add("25");
c.add("30");
c.add("35");
add(c);
add(b);
b.addActionListener(this);
}
public void paint(Graphics g)
{
g.drawString("name: "+name,20,100);
g.drawString("Gender: "+gender,20,120);
g.drawString("age: "+age,20,140);
}
public void actionPerformed(ActionEvent e)
{
name=n.getText();
gender=g.getSelectedCheckbox().getLabel();
age=Integer.parseInt(c.getSelectedItem());
repaint();
}
}
COMPLETED PROJECTS:
- How to Create Forgot System Password with PHP & MySQL
- Datatables Editable Add Delete with Ajax, PHP & MySQL-My programming school
- Download Login and Registration form in PHP & MySQL-MPS
- Export Data to Excel in Php Code -My programming school
- Hospital Database Management System with PHP MySQL
- Java projects for beginners | java developer software | UML diagram
- Traffic Light using Applet in Java | algorithm and source code
- Currency converter using java
- Java program to design simple calculator with the use of grid layout
- Simple Notepad Editor using java|Gui application
- Online quiz application using java GUI with complete source code
- How to create color changer mini-project using java applet with source code
- How to make a Calculator using java Swing, GUI
- Canteen food order, generate total bill using java swing
- Currency Convertor java project, swing component
- Python Number Guessing Game mini Project
See my more website