Simple form using applet in java | source code


Simple form using applet in java | source code
Simple form using applet in java | source code
 
Simple form using applet in java | source code

 

Source Code

/* This program is simple form page where you can enter your name and select gender using radio-button and select age  then click on button. Here you can find different option to select of age among that you can select any one. if you want to add more option so you can add in code
if you click on button then name , gender and age below.
*/
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();
}
}

For more Project
 

simple form using applet in java | source code

https://en.wikipedia.org/wiki/Java_applet

https://en.wikipedia.org/wiki/Applet

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories

You have successfully subscribed to myprogrammingschool

There was an error while trying to send your request. Please try again.

My Programming School will use the information you provide on this form to be in touch with you and to provide updates and marketing.