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

Assignment Lab OOP

Object oriented program

Uploaded by

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

Assignment Lab OOP

Object oriented program

Uploaded by

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

OOP-DCS20504

OBJECT ORIENTED PROGRAMMING CCS20704/DCS20504/TCS21304

Received Date :
Submission Due Date: 23rd May 2024
Lecturer :
Weightage : 30%
Semester : FEBRUARY 2024

Instruction to students:
• This is a GROUP assignment.
• Complete this cover sheet and attach it to your assignment (first page).

Student declaration:

I declare that:
• This assignment is my/our own work.
• I/we understand what is meant by plagiarism.
• My lecturer has the right to deduct my marks in case of:
- Late submission
Any plagiarism found in my assignment.

NAME: MUMTAJMOHAMED ALI NAME: Daniel Raj a/l Suracs Kumar


MATRICS NO: 012022071286 MATRICS NO: 012023071568
PROGRAMME: BICT PROGRAMME: BICT
OOP-DCS20504

Audio player graphical user interface (GUI)


An audio player with a Graphical User Interface (GUI) in Java is a software application designed
to play audio files while providing a visual interface for user interaction. Java, a versatile and
widely used programming language, offers robust libraries and frameworks that facilitate the
development of such applications. Utilizing Java's Swing or JavaFX libraries, developers can
create user-friendly and interactive audio players with features such as play, pause, stop, volume
control, and track navigation.

GUI Components

Playback controls:
Play Button: JButton (Swing) / Button (JavaFX): Initiates audio playback.
Pause Button: JButton (Swing) / Button (JavaFX): Pauses the audio playback.
Stop Button: JButton (Swing) / Button (JavaFX): Stops the audio playback.
Forward Button: JButton (Swing) / Button (JavaFX): Skips to the next track or moves forward in
the current track.
Rewind Button: JButton (Swing) / Button (JavaFX): Goes back to the previous track or rewinds
the current track.

Menu Bar:
JMenuBar (Swing) / Menu Bar (JavaFX): Provides a menu system for additional functionality
like opening files, saving playlists, or exiting the application.

File Menu:
Open File:
JMenuItem (Swing) / Menu Item (JavaFX): Allows users to open and select audio files.
Exit:
JMenuItem (Swing) / MenuItem (JavaFX): Closes the application.

Playlist Management:

Playlist Panel:
OOP-DCS20504

JList (Swing) / ListView (JavaFX): Displays a list of audio tracks that the user can select and
play.

Add/Remove Buttons: JButton (Swing) / Button (JavaFX): Adds or removes tracks from the
playlist.

File Chooser:JFileChooser (Swing) / FileChooser (JavaFX): Provides a dialog for users to


browse and select audio files from their file system.

Status Display:

Status Bar:

JLabel (Swing) / Label (JavaFX): Displays the status of the player, such as "Playing", "Paused",
or "Stopped".

Tactics aspects of the application modification:


REQUIREMENT ANALYSIS:

Identify User Needs: Stakeholders: Determine who will be using the audio player (e.g., general
users, audiophiles, visually impaired users) and what they expect from it.
Primary Functionalities: Establish the core features required, such as play, pause, stop, volume
control, track navigation, and support for various audio formats.

Accessibility Requirements: Visually Impaired Users: Consider features that make the
application accessible, such as screen reader compatibility, keyboard shortcuts, high contrast
modes, and text-to-speech support.

Usability: Ensure that the UI is designed for easy navigation and operation by all users,
including those with disabilities.
Technical Specifications:

Performance Requirements: Define performance criteria such as fast loading times, smooth
playback, and low resource consumption.
Audio Format Support: List the audio formats that the player must support, such as MP3, WAV,
AAC, etc.
OOP-DCS20504

User interface design:

Component Arrangement: Proper arrangement of playback controls (play, pause, stop, etc.),
volume controls, and progress bars to make them easily accessible.

Aesthetics: Ensuring the UI is visually appealing with appropriate use of colors, fonts, and
spacing.
Usability: Designing the interface to be intuitive, so users can understand and navigate it without
extensive instructions.

Responsiveness: Making sure the UI responds quickly to user actions, providing immediate
feedback (e.g., changing the play button to a pause button when clicked).
OOP-DCS20504

Code input to run the graphical user interface (GUI)

AudioPlayer.Java

package AudioPlayer;

import javax.swing.*;
import java.awt.*;

public class AudioPlayerFrame extends JFrame {


private PlaybackPanel playbackPanel;
private InfoPanel infoPanel;
private JPanel volumeControlPanel;
private JList<String> songList;
private JPanel songListPanel;
private JLabel volumeStatusLabel;
private JSlider volumeControlSlider;

public AudioPlayerFrame() {
super("Audio Player");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(600, 400);
setLocationRelativeTo(null);

// Initialize components
playbackPanel = new PlaybackPanel();
infoPanel = new InfoPanel();
volumeControlSlider = new JSlider(JSlider.HORIZONTAL, 0, 100, 50);
volumeStatusLabel = new JLabel("Volume: " + volumeControlSlider.getValue(),
JLabel.CENTER);

// Sample song list


String[] songs = {"Track A", "Track B", "Track C", "Track D", "Track E"};
songList = new JList<>(songs);
songList.setSelectedIndex(0);
OOP-DCS20504

// Volume control panel setup


JPanel volumePanel = new JPanel();
volumePanel.setLayout(new BoxLayout(volumePanel, BoxLayout.Y_AXIS));
JLabel volumeLabel = new JLabel("Volume:", JLabel.CENTER);
volumeLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
volumeStatusLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
volumePanel.add(Box.createVerticalGlue());
volumePanel.add(volumeLabel);
volumePanel.add(volumeControlSlider);
volumePanel.add(volumeStatusLabel);
volumePanel.add(Box.createVerticalGlue());

volumeControlPanel = new JPanel(new BorderLayout());


volumeControlPanel.add(volumePanel, BorderLayout.CENTER);

// Song list panel setup


songListPanel = new JPanel(new BorderLayout(5, 5));
songListPanel.add(new JLabel("Song List", JLabel.CENTER), BorderLayout.NORTH);
songListPanel.add(new JScrollPane(songList), BorderLayout.CENTER);

// Layout configuration
setLayout(new BorderLayout(10, 10));
add(playbackPanel, BorderLayout.NORTH);
add(infoPanel, BorderLayout.CENTER);
add(volumeControlPanel, BorderLayout.SOUTH);
add(songListPanel, BorderLayout.WEST);

// Add action listeners


playbackPanel.addPlayButtonListener(e -> infoPanel.updateStatus("Now Playing - " +
songList.getSelectedValue()));
playbackPanel.addPauseButtonListener(e -> infoPanel.updateStatus("Playback Paused"));
playbackPanel.addStopButtonListener(e -> infoPanel.updateStatus("Playback Stopped"));
volumeControlSlider.addChangeListener(e -> volumeStatusLabel.setText("Volume: " +
volumeControlSlider.getValue()));
}
OOP-DCS20504

ControlPanel.java

package AudioPlayer;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;

public class PlaybackPanel extends JPanel {


private JButton playButton;
private JButton pauseButton;
private JButton stopButton;

public PlaybackPanel() {
setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
playButton = new JButton("Play");
pauseButton = new JButton("Pause");
stopButton = new JButton("Stop");

add(playButton);
add(pauseButton);
add(stopButton);
}

public void addPlayButtonListener(ActionListener listener) {


playButton.addActionListener(listener);
}

public void addPauseButtonListener(ActionListener listener) {


pauseButton.addActionListener(listener);
}

public void addStopButtonListener(ActionListener listener) {


stopButton.addActionListener(listener);
OOP-DCS20504

}
}

InfoPanel.java
package AudioPlayer;

import javax.swing.*;
import java.awt.*;

public class InfoPanel extends JPanel {


private JLabel statusLabel;
private JProgressBar progressBar;

public InfoPanel() {
setLayout(new BorderLayout(5, 5));
statusLabel = new JLabel("Status: Not Playing", JLabel.RIGHT);
progressBar = new JProgressBar();
progressBar.setValue(0);

JPanel statusPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));


statusPanel.add(statusLabel);

add(statusPanel, BorderLayout.NORTH);
add(progressBar, BorderLayout.CENTER);

UIManager.put("ProgressBar.selectionBackground", Color.BLACK);
UIManager.put("ProgressBar.selectionForeground", Color.WHITE);
}

public void updateStatus(String status) {


statusLabel.setText("Status: " + status);
}
}
OOP-DCS20504

Sample Output:
Lauch screen of the audio player

The media player application showcased in the image provides a straightforward and user-friendly
interface for audio playback. The main components of the interface are clearly displayed,
including the track list, playback controls, and volume slider.

The track list features five song titles, allowing users to navigate and select the desired audio
content. The playback controls, consisting of "Play", "Pause", and "Stop" buttons, enable
seamless control over the playback experience. Additionally, the volume slider provides a
convenient way for users to adjust the audio output level to their preference.

The clean and minimalist design of the interface suggests a focus on simplicity and ease of use.
This approach likely caters to a wide range of users, from casual listeners to more experienced
media enthusiasts, by offering a straightforward and intuitive way to manage their audio files.

Overall, the media player application appears to provide a basic, yet functional, set of features
that allow users to efficiently play, pause, stop, and control the volume of their audio content. This
simplicity and accessibility could make the application appealing to a diverse user base seeking
a reliable and uncomplicated media playback experience.
OOP-DCS20504

The image shows a media player application with a simple and clean user interface. The main
components of the interface include the track list, playback controls (Play, Pause, Stop), and a
volume slider.

The track list displays five song titles: "Song A", "Song B", "Song C", "Song D", and "Song E". The
status information indicates that "Song A" is currently playing.

The playback controls allow the user to play, pause, and stop the audio playback. The volume
slider is present, with the current volume level set to 50.

The overall design of the interface is minimalist and user-friendly, suggesting a focus on providing
a straightforward and accessible media playback experience. This approach likely caters to a wide
range of users, from casual listeners to more experienced media enthusiasts, by offering a simple
and intuitive way to manage their audio content.
OOP-DCS20504

The image shows the media player application with the status indicating that the playback is
currently paused.
OOP-DCS20504

The updated image shows the media player application with the status indicating that "Song B" is
currently playing.
RUBRIC FOR ASSIGNMNET 3

Needs Improvement Marks


Criteria Excellent (4) Good (3) Satisfactory (2) (1)
Demonstrates exceptional
Demonstrates basic code
proficiency in modifying Exhibits limited code
Code Displays proficient code modification skills with some
code, executing changes modification skills with
Modification and modification skills with accuracy. May encounter
accurately, efficiently, and frequent errors.
Problem-Solving accurate implementation and challenges in creative
(20%) creatively. Displays Struggles with problem-
good problem-solving abilities. solutions and problem-
advanced problem-solving solving aspects.
solving.
skills.
Struggles to effectively
Clearly and effectively
Demonstrates practical demonstrate the
demonstrates the practical Effectively showcases
Practical application but with practical application of
application of the modified practical application, though
Application occasional inconsistencies. the modified code.
code in the presentation. some areas may lack clarity or
(20%) Some areas may require Actions may not align
Actions align seamlessly could be more fluid.
improvement in execution. well with intended
with intended outcomes.
outcomes.
Includes at least 5 diverse Includes 5 components as Includes fewer than 5
Component components in the required, with a good variety. Includes at least 5 components or lacks
Diversity and application, showcasing May lack creativity in the components, but the variety variety, impacting the
Creativity (20%) creativity and a wide skill selection or execution of some or execution may be limited. overall scope of the
set. components. modification.
Provides a thorough
Insightful Tactile Offers minimal
discussion of the tactile Offers clear insights into the Provides basic insights into
Aspects information on the
aspects of modifications, tactile aspects but may lack the tactile aspects, with
Discussion tactile aspects, lacking
detailing precision and depth in some areas. limited depth or detail.
(20%) clarity and depth.
coordination involved.
High creativity, excellent Some creativity and code Limited creativity and code Lack of creativity and
code clarity, and clarity. Documentation is clarity. Minimal or unclear code clarity. No
comprehensive present but incomplete, documentation is present, documentation is
Creativity, Code documentation explaining showing moderate creativity demonstrating minimal effort provided, indicating
Clarity, and the thought process, and an attempt at code in adding creativity and poor creativity and an
Documentation purpose of explanation. explaining the code. absence of code
(10%) attributes/methods, and explanations.
control structure usage,
reflecting strong creativity
and effective code
explanations.

Team Member Evaluation (10%) (S1) (S1) (S3)


1) Task Completion
2) Quality of Work
3) Collaboration & Communication
4) Problem-Solving & Initiative
5) Team Support & Flexibility

Detail please refer to the Google Form link: https://forms.gle/ATaFv6NUL9spuZ6o9

TOTAL MARKS

REMARKS
__________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________

You might also like