How To Create A Simple Registration Form Using Java Applet with Source Code

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.
How To Create A Simple Registration Form Using Java Applet

 

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:

See my more website

Pramod Kumar Yadav is from Janakpur Dham, Nepal. He was born on December 23, 1994, and has one elder brother and two elder sisters. He completed his education at various schools and colleges in Nepal and completed a degree in Computer Science Engineering from MITS in Andhra Pradesh, India. Pramod has worked as the owner of RC Educational Foundation Pvt Ltd, a teacher, and an Educational Consultant, and is currently working as an Engineer and Digital Marketer.



Leave a Comment