AJP Report Final
AJP Report Final
A
REPORT ON
“ Develop a bouncing ball application”
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.
Date:
Place: Kolhapur
Index
1 Rationale 1
4 Literature Review 1
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.
Benefit:
2. Bard https://bard.google.com/chat
1|Page
Develop a bouncing ball application
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.
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
4. Links https://www.javatpoint.com/
https://bard.google.com/chat
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
int x = 150;
int y = 150;
int xSpeed = 2;
int ySpeed = 2;
public BallPanel() {
3|Page
Develop a bouncing ball application
moveBall();
repaint();
});
t.start();
x = x + xSpeed;
y = y + ySpeed;
xSpeed = -xSpeed;
ySpeed = -ySpeed;
super.paintComponent(g);
g.setColor(Color.BLUE);
4|Page
Develop a bouncing ball application
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setSize(700, 500);
jf.add(BallPanel());
jf.setVisible(true);
5|Page
Develop a bouncing ball application
6|Page