Making Form Applet And Adding Checkboxs On Java

Words
105
Reading
1 min
Listen
Play
9y

What Will I Learn?

  • You will learn how to create an applet
  • You will learn how to create a form on java
  • You will learn adding checkbox on form

Requirements

  • Eclipse and java
  • Knowledge of coding

Difficulty

  • Basic

Description

This tutorial will help you to create a form and add checkboxs on your created form,also you will learn how to set background color with using setbackground.Also defining labels and using text fields is in the course.Finally you will learn how to create a button for your form applet.

Code Screenshots

a.png

b.png

import java.awt.*;
import java.applet.Applet;

@SuppressWarnings("serial")
public class applet extends Applet
{
    
public void init()
{
    
setBackground(Color.red);

Label lbname=new Label("name");
Label lbsurname=new Label("surname");
Label lbage=new Label("age");
Label lbgender=new Label("gender");
Label lbteam=new Label("team");

TextField txtname=new TextField();
TextField txtsurname=new TextField();

TextArea txtage=new TextArea(3,5);

CheckboxGroup cbgender=new CheckboxGroup();

Checkbox cbliverpool=new Checkbox("liverpool");
Checkbox cbbarcelona=new Checkbox("barcelona");
Checkbox cbjuventus=new Checkbox("juventus");

Button btnwrt=new Button("Send");

add(lbname);
add(txtname);
add(lbsurname);
add(txtsurname);
add(lbage);
add(txtage);
add(lbgender);
add(cbgender);
add(new Checkbox("Man",cbgender,true));
add(new Checkbox("Women",cbgender,false));
add(lbteam);
add(cbliverpool);
add(cbbarcelona);
add(cbjuventus);
add(btnwrt);
}

private void add(CheckboxGroup cbgender)
{

}
}

Video Tutorial



Posted on Utopian.io - Rewarding Open Source Contributors

Making Form Applet And Adding Checkboxs On Java | Ecency