Design an applet application to create form using textfield TextArea Button and Label

import java.awt.*; import java.awt.event.*; class MyLoginWindow extends Frame { TextField name,pass; Button b1,b2; MyLoginWindow() { setLayout(new FlowLayout()); this.setLayout(null); Label n=new Label("Name:",Label.CENTER); Label p=new Label("password:",Label.CENTER); name=new TextField(20); pass=new TextField(20); pass.setEchoChar('#'); b1=new Button("submit"); b2=new Button("cancel"); this.add(n); this.add(name); this.add(p); this.add(pass); this.add(b1); this.add(b2); n.setBounds(70,90,90,60); p.setBounds(70,130,90,60); name.setBounds(200,100,90,20); pass.setBounds(200,140,90,20); b1.setBounds(100,260,70,40); b2.setBounds(180,260,70,40); } public static void main(String args[]) { MyLoginWindow ml=new MyLoginWindow(); ml.setVisible(true); ml.setSize(400,400); ml.setTitle("my login window"); } }

 OUTPUT:

C:\java>javac MyLoginWindow.java C:\java>java MyLoginWindow

Design an applet application to create form using textfield TextArea Button and Label


Design an applet application to create form using textfield TextArea Button and Label

1) Design a applet/application to demonstrate the use of Radio Button and Checkbox. Ans:import java.awt.*; import java.util.*; public class RadioDemo { public static void main( String args[] ) { Frame f = new Frame(); f.setVisible(true); f.setSize(400,400); f.setLayout(new FlowLayout()); Label l1 = new Label("Select Subjects:"); Checkbox cb1 = new Checkbox("English"); Checkbox cb2 = new Checkbox("Sanskrit"); Checkbox cb3 = new Checkbox("Hindi"); Checkbox cb4 = new Checkbox("Marathi"); Label l2 = new Label("Select Gender:"); CheckboxGroup cg = new CheckboxGroup(); Checkbox c1 = new Checkbox("Male",cg,true); Checkbox c2 = new Checkbox("Female",cg,true); f.add(l1); f.add(cb1); f.add(cb2); f.add(cb3); f.add(cb4); f.add(l2); f.add(c1); f.add(c2); } } Output:

Design an applet application to create form using textfield TextArea Button and Label

2) Design an applet/application to create form using Text Field, Text Area, Button and Label. Ans:import java.awt.*; public class BasicAWT { public static void main(String args[]) { Frame f = new Frame(); f.setSize(400,400); f.setVisible(true); f.setLayout(new FlowLayout() ); Label l1 = new Label(); l1.setText("Enter Your Name "); TextField tf = new TextField("Atharva"); Label l2 = new Label("Address"); TextArea ta = new TextArea("",3,40); Button b = new Button("Submit"); f.add(l1); f.add(tf); f.add(l2); f.add(ta); f.add(b); } }

Design an applet application to create form using textfield TextArea Button and Label

2. Design an applet/application to create form using Text Field, Text Area, Button and Label. import java.applet.*; import java.awt.*; import java.awt.event.*; import java.net.*; import java.net.InetAddress; /*<applet code="form" height=500 width=800></applet>*/ public class form extends Applet implements ActionListener{ String msg=""; Label l1,l2,l3,l4,l5; TextField t1;