Professional Documents
Culture Documents
Myadvancejavaproject
Myadvancejavaproject
Myadvancejavaproject
Micro Project
on
“Music Player Using Java”
Submitted in partial fulfillment of the requirement for the award of
Diploma of Engineering
in
Computer Engineering
By
Pragati Bavaskar
Arpan Pandit
Dhiraj Chaudhari
Sarth Gawad
Mr.Nikhil Asolkar
Department of Computer
Engineering
December 2022
CERTIFICATE
GROUP MEMBERS
19-Pragati Bavaskar
25 – Arpan Pandit
26-Dhiraj Chaudhari
PART –A PLAN
1 Brief Introduction 1
3 Resources Required 2
PART –B OUTCOMES
1 Brief Description 3
2 Aim of Micro-Project 4
PART-A PLAN
Music Player lets you manage all your music files quickly and easily . This
audio player supports almost all types of mp3 , midi ,wav , flac raw aac files and other
audio formats . Easily browse and play music songs by genres , albums , artists , songs
and folder. Media is integral parts of our lives. We are creating media player using java to
handle all the music requirements of user.
James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java
language project in June 1991. Java was originally designed for interactive television, but
it was too advanced for the digital cable television industry at the time. The language was
initially called Oak after an oak tree that stood outside Gosling's office. Later the project
went by the name Green and was finally renamed Java, from Java coffee, the coffee from
Indonesia. Gosling designed Java with a C/C++-style syntax that system and application
programmers would find familiar.
4
AJP 22517, Sem V
“Music Player Using Java”
To Design a java program play music stored on machine and control it using various java
components.
5
“Music Player Using Java” AJP 22517, Sem V
PART-BOUTCOME
Java was originally developed by James Gosling at Sun Microsystems (which has since been
acquired by Oracle) and released in 1995 as a core component of Sun Microsystems' Java platform.
The original and reference implementation Java compilers, virtual machines, and class libraries
were originally released by Sun under proprietary licenses. As of May 2007, in compliance with
the specifications of the Java Community Process, Sun had relicensed most of its Java technologies
under the GNU General Public License. Oracle offers its own HotSpot Java Virtual Machine,
however the official reference implementation is the OpenJDK JVM which is free open source
software and used by most developers and is the default JVM for almost all Linux distributions.
Music Player lets you manage all your music files quickly and easily . This audio
player supports almost all types of mp3 , midi ,wav , flac raw aac files and other audio formats
. Easily browse and play music songs by genres , albums , artists , songs and folder. Media is
integral parts of our lives. We are creating media player using java to handle all the music
requirements of user.
James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in
June 1991. Java was originally designed for interactive television, but it was too advanced for the digital
cable television industry at the time. The language was initially called Oak after an oak tree that stood
outside Gosling's office. Later the project went by the name Green and was finally renamed Java, from Java
coffee, the coffee from Indonesia. Gosling designed Java with a C/C++-style syntax that system and
application programmers would fi
6
“Music Player Using Java” AJP 22517, Sem V
7
“Music Player Using Java” AJP 22517, Sem V
Code:-
package com.dataflair.mp3.dataflair.mp3musicplayer;
import javazoom.jl.player.Player;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
public class MusicPlayer implements ActionListener {
JFrame frame;
JLabel songName;
JButton select;
JPanel playerPanel, controlPanel;
Icon iconPlay, iconPause, iconResume, iconStop;
JButton play, pause, resume, stop;
JFileChooser fileChooser;
FileInputStream fileInputStream;
BufferedInputStream bufferedInputStream;
File myFile = null;
String filename, filePath;
long totalLength, pauseLength;
Player player;
Thread playThread, resumeThread;
public MusicPlayer() {
initUI();
ons
addActionEvents();
playThread = new Thread(runnablePlay);
resumeThread = new Thread(runnableResume);
}
public void initUI() {
songName = new JLabel("", SwingConstants.CENTER);
select = new JButton("Select Mp3");
playerPanel = new JPanel();
controlPanel = new JPanel();
9
“Music Player Using Java” AJP 22517, Sem V
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
if (e.getSource().equals(resume)) {
if (filename != null) {
resumeThread.start();
} else {
songName.setText("No File was selected!");
}
}
if (e.getSource().equals(stop)) {
if (player != null) {
player.close();
songName.setText("");
}
}
Runnable runnablePlay = new Runnable() {
@Override
public void run() {
try {
fileInputStream = new FileInputStream(myFile);
bufferedInputStream = new BufferedInputStream(fileInputStream);
player = new Player(bufferedInputStream);
totalLength = fileInputStream.available();
player.play();
} catch (Exception e) {
e.printStackTrace();
}
}
};
Runnable runnableResume = new Runnable() {
@Override
public void run() {
try {
10
“Music Player Using Java” AJP 22517, Sem V
11
“Music Player Using Java” AJP 22517, Sem V
12
“Music Player Using Java” AJP 22517, Sem V
13
“Music Player Using Java” AJP 22517, Sem V
We have finally built our mp3 music player in java. Now we can listen to any mp3 music on our desktop.
From this java project, we have learned how to integrate any extra library to the project, how to do file
operations, and how to create user interface components such as frame, panels, buttons, labels, filechooser,
etc with the help of AWT and Swing packages. Thus we build music player using Java and various GUI
components.
14