0% found this document useful (0 votes)
5 views4 pages

Practical No 3

The document contains practical Java programming assignments from DKTE’s Yashwantrao Chavan Polytechnic, showcasing the creation of applets with various layouts, including GridLayout and BorderLayout. Each program demonstrates the use of buttons arranged in different configurations, such as a 5x5 grid and a flow layout for buttons numbered 0 to 9. The author of the document is Vedraj Sanjay Jagdale, and it includes code snippets for each program along with their intended output.

Uploaded by

gxyz8837
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Practical No 3

The document contains practical Java programming assignments from DKTE’s Yashwantrao Chavan Polytechnic, showcasing the creation of applets with various layouts, including GridLayout and BorderLayout. Each program demonstrates the use of buttons arranged in different configurations, such as a 5x5 grid and a flow layout for buttons numbered 0 to 9. The author of the document is Vedraj Sanjay Jagdale, and it includes code snippets for each program along with their intended output.

Uploaded by

gxyz8837
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

DKTE’S Yashwantrao Chavan Polytechnic , Ichalkaranji

Practical No : 03
Enrollment No : 2215770092
Name : Vedraj Sanjay jagdale
Program No 1 : Write a java program to Demonstrate Grid of 5 * 5.
Code :
import java.awt.*; import
java.applet.*;
//<applet code="Gridexample" width=500 height=500></applet> public
class Gridexample extends Applet
{
public void init()
{
setLayout(new GridLayout(5,5));
Button b1=new Button("A");
Button b2=new Button("B");
Button b3=new Button("C");
Button b4=new Button("D");
Button b5=new Button("E");
add(b1);
add(b2); add(b3);
add(b4);
add(b5);

}
}

Output :

Vedraj Sanjay jagdale


DKTE’S Yashwantrao Chavan Polytechnic , Ichalkaranji

Program No 2 : Write a program to display the Number of buttons from 0 to 9.


Code :

import java.awt.*; import


java.applet.*;
//<applet code="Buttonexample" width=500 height=500></applet> public
class Buttonexample extends Applet
{
public void init()
{
setLayout(new FlowLayout());
Button b1=new Button("0");
Button b2=new Button("1");
Button b3=new Button("2");
Button b4=new Button("3");
Button b5=new Button("4");
Button b6=new Button("5");
Button b7=new Button("6");
Button b8=new Button("7");
Button b9=new Button("8");
Button b10=new Button("9");
add(b1);
add(b2); add(b3);
add(b4);
add(b5); add(b6);
add(b7);
add(b8); add(b9);
add(b10);
}
}
Output :

Vedraj Sanjay jagdale


DKTE’S Yashwantrao Chavan Polytechnic , Ichalkaranji

Program No 3 : Write a Program to Gererate Following Output .


Code :
import java.awt.*; import
java.applet.*;
//<applet code="ButtonGrid" width=500 height=500></applet> public
class ButtonGrid extends Applet
{
public void init()
{
setLayout(new GridLayout(3,2,5,5));
Button b1=new Button("Button 1");
Button b2=new Button("Button 2");
Button b3=new Button("Button 3");
Button b4=new Button("Button 4");
Button b5=new Button("Button 5");
add(b1);
add(b2); add(b3);
add(b4);
add(b5);
}
}
Output :

Vedraj Sanjay jagdale


DKTE’S Yashwantrao Chavan Polytechnic , Ichalkaranji

Program No 4 : Write a Program to generate Following output using Border


Layout .
Code :
import java.awt.*; import
java.applet.*;
//<applet code="BorderLayoutExample" width=500 height=500></applet> public
class BorderLayoutExample extends Applet
{
public void init()
{
setLayout(new BorderLayout());
Button b1=new Button("North");
Button b2=new Button("Center");
Button b3=new Button("East");
Button b4=new Button("West");
Button b5=new Button("South");
add(b1,BorderLayout.NORTH);
add(b2,BorderLayout.CENTER);
add(b3,BorderLayout.EAST);
add(b4,BorderLayout.WEST);
add(b5,BorderLayout.SOUTH);
}
}

Output :

Vedraj Sanjay jagdale

You might also like