0% found this document useful (0 votes)
18 views

AJP Report Final

Uploaded by

Rajwardhan Patil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

AJP Report Final

Uploaded by

Rajwardhan Patil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MUMBAI

A
REPORT ON
“ Develop a bouncing ball application”

UNDER THE GUIDANCE OF


MR. P. K. Shinde

DEPARTMENT OF COMPUTER ENGINEERING


DR. D. Y. PATIL POLYTECHNIC,
KASABA BAWADA, KOLHAPUR
SEMESTER - V
YEAR :- 2023-24
SUBMITTED BY:-

1) SAKIB FAIYAJ ATTAR Roll No 3132


2) PARTH MAHENDRA JADHAV Roll No 3133
3) HARSHVARDHAN JAYSING PATIL Roll No 3134
4) AFTABALAM IQBAL MAKANDAR Roll No 3135
Certificate

This is to certify that ……………….….G-09………….…………….

From Dr. D. Y. Patil Polytechnic. Having Enrollment no-

2105390136 , 2105390169 , 2105390153 , 2105390170

Has successfully completed ‘Project Report ’ Having title “ Develop

a bouncing ball application ” in a Group consisting of

…4… Persons under the Guidance of the MR. P. K. Shinde.

Signature Signature
Head of the Department Seal Head of the Institute
ACKNOWLEDGMENT

It’s our Pleasure to express sincere and heartiest thanks to our Micro-
Project guide Prof. P. K. Shinde for their valuable guidance,
encouragement and support for the accomplishment of Micro-Project.

We are also really thankful to our Principal Prof. M. M. Narke and the
Head of Department Prof. P. K. Shinde. for their constant
encouragement and motivation for the accomplishment of the Micro-
Project by expressing their guidelines regarding importance of Micro-
Project in developing our career.

I am thankful to Co-workers of this Micro-Project for their valuable


contribution. We are thankful to all those peoples who directly or
indirectly helped us in completion of this Micro Project.

Thank you All.

Date:
Place: Kolhapur
Index

Sr. No. Content Page No.

1 Rationale 1

2 Aims/Benefits of the Micro-Project 1

3 Course Outcome Achieved 1

4 Literature Review 1

5 Actual Methodology Followed 2

6 Actual Resources Used 3

7 Outputs of the Micro-Project 3-5

8 Skill Developed / Learning outcome of this 6


Micro-Project

9 Application of this Micro-Project 6


Develop a bouncing ball application

1.0 Rationale:

The "Bouncing Ball App" is a Java program that showcases the fundamental principles of
graphical user interface (GUI) development and animation using Java's Swing library. This
application offers an engaging visual experience as it animates a bouncing blue ball within
a resizable window. By dissecting the code, we can gain insights into how Java Swing
components, event handling, and Graphics come together to create a dynamic view . This
report provides a comprehensive overview of the code, its components, and its
functionality, offering a clear understanding of how the bouncing ball animation is
achieved.

2.0 Aims/Benefits of the Micro-Project:


Aim: Develop a bouncing ball application

Benefit:

a. Able to develop bouncing ball application using different swing components.

b. Understand Events Handling , Event Listeners.

c. Understand the timer class.

3.0 Course Outcomes Addressed:

1. Develop programs using GUI Framework (AWT and Swing)


2. Handle events of AWT and Swing components.
3. Develop programs to handle events in Java Programming.

4.0 Literature Survey –

Sr. No. Title of Website Link


1. JavaPoint https://www.javatpoint.com/

2. Bard https://bard.google.com/chat

1|Page
Develop a bouncing ball application

5.0Actual Methodology Followed:

1. Gathered Information:

1. JFrame : JFrame is a window with decorations such as borders, title bar, and buttons for
minimizing, maximizing, and closing the window. It serves as the main window for many
Swing applications and typically contains other Swing components like buttons, labels,
panels.
- JFrame(String title): This constructor creates a new JFrame with the specified
title. The title appears in the window's title bar.

2. Timer : The Timer class is a Swing-based utility class used to schedule and generate action
events at specified time intervals.
- Timer(int delay, ActionListener listener) : 'delay' is an integer representing the
time interval in milliseconds and 'listener' is an ActionListener object that will be
notified when the Timer's action event occurs.

3. ActionEvent Class: ActionEvent is a class in Java's Abstract Window Toolkit (AWT) and
Swing library.It represents an event that occurs when a user interacts with a graphical user
interface (GUI) component, like clicking a button.Contains information about the event, such
as the source component and the action command.

- ActionListener Interface: ActionListener is an interface in Java used for handling action


events in GUI applications.It defines a single method, actionPerformed(ActionEvent e),
which is called when an action event occurs.Commonly used to add interactivity to GUI
components like buttons, menu items, and more.

4. Graphics class : The Graphics class is a fundamental class in Java's Abstract Window
Toolkit (AWT) and is used for rendering graphics on a graphical component, such as a Canvas
or JPanel. It provides methods for drawing shapes, images, and text on a graphical surface.

- fillOval(int x, int y, int width, int height) : The fillOval() method is a member of the Graphics
class in Java. It is used to draw and fill an oval shape on a graphical component.

2|Page
Develop a bouncing ball application

6.0 Actual Resources Used:

Sr. No. Name of Resource/material Specifications

1. Computer System DELL optiplex,2.93 GHz, 2 GB< RAM,


500 GB HDD
2. Operating System Windows 10

3. Software JDK 17.0.2

4. Links https://www.javatpoint.com/
https://bard.google.com/chat

7.0 Outputs of the Micro-Project:

Program Code for Quiz Application:

import javax.swing.*;

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

class BallPanel extends JPanel {

int x = 150;

int y = 150;

int xSpeed = 2;

int ySpeed = 2;

int ballSize = 50;

public BallPanel() {

Timer t = new Timer(10, new ActionListener() {

3|Page
Develop a bouncing ball application

public void actionPerformed(ActionEvent e) {

moveBall();

repaint();

});

t.start();

private void moveBall() {

x = x + xSpeed;

y = y + ySpeed;

if (x < 0 || x > getWidth() - ballSize)

xSpeed = -xSpeed;

if (y < 0 || y > getHeight() - ballSize)

ySpeed = -ySpeed;

public void paintComponent(Graphics g) {

super.paintComponent(g);

g.setColor(Color.BLUE);

g.fillOval(x, y, ballSize, ballSize);

public class BouncingBallAppwh {

public static void main(String[] args) {

JFrame jf = new JFrame("Bouncing Ball App");

4|Page
Develop a bouncing ball application

jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

jf.setSize(700, 500);

jf.add(BallPanel());

jf.setVisible(true);

Output : - The Ball in Below images are consistently moved

5|Page
Develop a bouncing ball application

8.0 Skill Developed / Learning outcome of this Micro-Project

a) Understand the concept Of ActionListener.


b) Understand the concept and implement Swing Library class (like Timer ) and
Methods(like paintComponent).

9.0 Application of this Micro-Project

1. Develop a live Wallpaper using Bouncing Ball Application.


2. Develop a game Using Bouncing Ball Application.

6|Page

You might also like