SRI KRISHNASAMY ARTS AND SCIENCE COLLEGE
(An ISO 9001:2015 Certified Institution)
(Affiliated to Madurai Kamaraj University)
Mettamalai, Sattur – 626203
LABORATORY RECORD NOTE BOOK
Department of Computer Applications
Register No: ………………………….
Certified that this is a bonafied record of work done by the candidate
Mr/Ms ……………………………of Bachelor of Computer Applications in
SCAJC6P - Web Programming laboratory during the academic year
2024-2025.
Staff-in-Charge Head of the Department
University Examination held on ………………….
Internal Examiner External Examiner
INDEX
PAGE
[Link] DATE PROGRAM SIGNATURE
NO
1. AWT Controls
2. Border layout
3. Card layout
4. Flow layout
5. Grid layout
6. Color Palette Creation
7. Web Page Creation using CSS
Web Page Embed with MAP and
8.
Hotspot
9. Implementation of HTTP Request
10. UDP Client Chat
[Link] AWT Controls
Aim:
To demonstrate Text Field, Button, Scrollbar, Choice list, Checkbox using Applet in java.
Source Code:
[Link]
import [Link].*;
public class ButtonExample
{
public static void main (String[] args)
{
Frame f = new Frame("Button Example");
Button b = new Button("Click Here");
[Link](50,100,80,30);
[Link](b);
[Link](400,400);
[Link](null);
[Link](true);
} }
Output:
C:\jdk1.5\bin> javac [Link]
C:\ jdk1.5\bin>> java ButtonExample
Result:
Thus above program was successfully executed and the output is verified.
[Link] Program to Demonstrate Layouts
Aim:
To demonstrate Text Field, Button, Scrollbar, Choice list, Checkbox using Applet in java.
Source Code:
[Link]
OUTPUT:
C:\jdk1.5\bin> javac [Link]
C:\ jdk1.5\bin>>java BorderDemo
Result:
Thus above program was successfully executed and the output is verified.
[Link] Program to Demonstrate Card Layouts
Aim:
To demonstrate Card Layout using Applet in java.
Source Code:
[Link]
port [Link].*;
port [Link].*;
port [Link].*;
blic class CardLayoutExample2 extends JFrame implements ActionListener{
rdLayout card;
utton b1,b2,b3;
ntainer c;
CardLayoutExample2(){
c=getContentPane();
card=new CardLayout(40,30);
[Link](card);
b1=new JButton("Apple");
b2=new JButton("Boy");
b3=new JButton("Cat");
[Link](this);
[Link](this);
[Link](this);
[Link]("a",b1);[Link]("b",b2);[Link]("c",b3);
}
public void actionPerformed(ActionEvent e) {
[Link](c);
}
public static void main(String[] args) {
CardLayoutExample2 cl=new CardLayoutExample2();
[Link](400,400);
[Link](true);
[Link](EXIT_ON_CLOSE);
}
OUTPUT:
C:\jdk1.5\bin> javac [Link]
C:\jdk1.5\bin>>java CardLayoutExample2
Result:
Thus above program was successfully executed and the output is verified.
[Link] Program to Demonstrate Flow Layouts
Aim:
To demonstrate Flow Layout using Applet in java.
Source Code:
[Link]
import [Link].*;
import [Link].*;
public class FlowLayoutExample
{
JFrame frameObj;
FlowLayoutExample()
{
frameObj = new JFrame();
JButton b1 = new JButton("1");
JButton b2 = new JButton("2");
JButton b3 = new JButton("3");
JButton b4 = new JButton("4");
JButton b5 = new JButton("5");
JButton b6 = new JButton("6");
JButton b7 = new JButton("7");
JButton b8 = new JButton("8");
JButton b9 = new JButton("9");
JButton b10 = new JButton("10");
[Link](b1); [Link](b2); [Link](b3); [Link](b4);
[Link](b5); [Link](b6); [Link](b7); [Link](b8);
[Link](b9); [Link](b10);
[Link](new FlowLayout());
[Link](300, 300);
[Link](true);
}
public static void main(String argvs[])
{
new FlowLayoutExample();
}
}
OUTPUT:
C:\jdk1.5\bin> javac [Link]
C:\jdk1.5\bin>>java FlowLayoutExample
Result:
Thus above program was successfully executed and the output is verified.
[Link] Program to Demonstrate Grid Layouts
Aim:
To demonstrate Grid Layout using Applet in java.
Source Code:
[Link]
import [Link].*;
import [Link].*;
public class MyGridLayout{
JFrame f;
MyGridLayout(){
f=new JFrame();
JButton b1=new JButton("1");
JButton b2=new JButton("2");
JButton b3=new JButton("3");
JButton b4=new JButton("4");
JButton b5=new JButton("5");
JButton b6=new JButton("6");
JButton b7=new JButton("7");
JButton b8=new JButton("8");
JButton b9=new JButton("9");
[Link](b1); [Link](b2); [Link](b3);
[Link](b4); [Link](b5); [Link](b6);
[Link](b7); [Link](b8); [Link](b9);
[Link](new GridLayout(3,3));
[Link](300,300);
[Link](true);
}
public static void main(String[] args) {
new MyGridLayout();
}
}
OUTPUT:
C:\jdk1.5\bin> javac [Link]
C:\jdk1.5\bin>>java MyGridLayout
Result:
Thus above program was successfully executed and the output is verified.
[Link] Color Palette Creation
Aim:
To demonstrate Color Palette Creation using Applet in java.
Source Code:
[Link]
port [Link].*;
port [Link].*;
ass ColorExample extends JFrame
ColorExample()
super("color");
Color c1 = new Color(0, 0, 204);
JPanel p = new JPanel();
[Link](c1);
setSize(200, 200);
add(p);
show();
public static void main(String args[])
ColorExample c = new ColorExample();
OUTPUT:
C:\jdk1.5\bin>javac [Link]
C:\jdk1.5\bin>>java ColorExample
Result:
Thus above program was successfully executed and the output is verified.
[Link] Web Page Creation using CSS
Aim:
To Create a Web Page Creation using CSS.
Source Code:
<html>
<html lang="en">
<meta charset="UTF-8">
<title>My Title</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="[Link]">
<style>
</style>
<body bgcolor="yellow">
<div>
<h1>Simple Web Page Creation using CSS</h1>
<p>Welcome to SKAASC.</p>
<p>This is a paragraph.</p>
</div>
</body>
</html>
OUTPUT:
Result:
Thus above program was successfully executed and the output is verified.
[Link] Web Page with Map and Hotspot
Aim:
To Create a Web Page with Map and Hotspot.
Source Code:
[Link]
<html>
<body>
<h2>Webpage with Map and Hotspot</h2>
<img src="[Link]" alt="Workplace" usemap="#workmap" width="400"height="379">
<map name="workmap">
<area shape="circle" coords="337,300,44" alt="Cup of coffee" href="[Link]">
</map>
</body>
</html>
[Link]
<html>
<body>
<p>
India,
It is the seventh-largest country by area and the second-most populous country.
And Lanka and the Maldives; its Andaman and Nicobar Islands share a maritime border with Thailand, Myanmar,
and Indonesia.
</p>
</body>
</html>
OUTPUT:
Result:
Thus above program was successfully executed and the output is verified.
[Link] Implementation of HTTP Request
Aim:
Program to implement to HTTP Request.
Source Code:
[Link]
import [Link].*;
public class Demo
{
public static void main(String[] args) throws Exception
{
URL url = new URL("[Link]
HttpURLConnection connection = (HttpURLConnection) [Link]();
[Link]("GET");
String date = [Link]("Date");
[Link](date);
}
}
D:\>javac [Link]
D:\>java Demo
OUTPUT:
Fri, 06 feb 2023 02:52:29 GMT
Result:
Thus above program was successfully executed and the output is verified.
[Link] UDP Chat Client
Aim:
Program to Demonstrate UDP Client chat Application.
Source Code:
[Link]
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class udpclient
{
public static void main(String args[]) throws IOException
{
Scanner sc = new Scanner([Link]);
DatagramSocket ds = new DatagramSocket();
InetAddress ip = [Link]();
byte buf[] = null;
while (true)
{
String inp = [Link]();
buf = [Link]();
DatagramPacket DpSend =
new DatagramPacket(buf, [Link], ip, 1234);
[Link](DpSend);
if ([Link]("bye"))
break;
}
}
}
[Link]
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class udpserver
{
public static void main(String[] args) throws IOException
{
DatagramSocket ds = new DatagramSocket(1234);
byte[] receive = new byte[65535];
DatagramPacket DpReceive = null;
while (true)
{
DpReceive = new DatagramPacket(receive, [Link]);
[Link](DpReceive);
9+
[Link]("Client:-" + data(receive));
if (data(receive).toString().equals("bye"))
{
[Link]("Client sent bye.....EXITING");
break;
}
receive = new byte[65535];
}
}
public static StringBuilder data(byte[] a)
{
if (a == null)
return null;
StringBuilder ret = new StringBuilder();
int i = 0;
while (a[i] != 0)
{
[Link]((char) a[i]);
i++;
}
return ret;
}
}
OUTPUT:
Client side Implementation
Hello
I am Client.
...
bye
Server side Implementation
Client:- Hello
Client:- I am client.
...
Client:- bye
Client sent bye.....EXITING
Result:
Thus above program was successfully executed and the output is verified.