Interviews Questions, Algorithms, Aptitude, C Interview Program, C Theory Question, Aptitude Tricks, Test Series,

Sunday 17 February 2019

Fourth Week Term Work Program 3

3) Write a Java Program that creates an AWT window that should produce the following output when executed:






Program:

import java.awt.*;
import java.awt.event.*;
public class awtsecond extends Frame{
Button button1,button2,button3;
List l1;
TextField t1;
Label l;
Checkbox c1;
awtsecond(){
button1=new Button("RED");
button2=new Button("BLUE");
button3=new Button("WHITE");
button1.setBounds(20, 70, 70, 30);
button2.setBounds(95, 70, 70, 30);
button3.setBounds(170, 70, 70, 30);
add(button1);
add(button2);
add(button3);
    l1=new List(7);
l1.add("Monday");
l1.add("Tuesday");
l1.add("Wednesday");
l1.add("Thursday");
l1.add("Friday");
l1.add("Saturday");
l1.add("Sunday");
l1.setBounds(250, 50, 100, 60);
add(l1); c1=new Checkbox("Pick Me");
c1.setBounds(360, 60, 60, 50);
add(c1);
l=new Label("Enter Name Here");
l.setBounds(420, 60, 100, 50);
add(l);
t1=new TextField();
t1.setBounds(505, 70, 200, 30);
add(t1);
setTitle("Flowlayout");
setSize(730,150);
setLayout(null);
setVisible(true);
}
public static void main(String[] args) {
new awtsecond();
}

}


Output:

0 comments:

Post a Comment