Initial commit
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2021 William Hubbard. All Rights Reserved.
|
||||
*/
|
||||
|
||||
package edu.regis.universe_player.player;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
* This panel links to various song collections the player has set up.
|
||||
*
|
||||
* @author William Hubbard
|
||||
* @version 0.1
|
||||
*/
|
||||
public class Collections extends JPanel
|
||||
{
|
||||
JLabel allSongs;
|
||||
JLabel artists;
|
||||
JLabel albums;
|
||||
JLabel genres;
|
||||
JLabel years;
|
||||
JLabel playlists;
|
||||
|
||||
public Collections()
|
||||
{
|
||||
JLabel label;
|
||||
BoxLayout layout = new BoxLayout(this, BoxLayout.Y_AXIS);
|
||||
this.setLayout(layout);
|
||||
|
||||
this.add(this.allSongs = label = new JLabel("All Songs"));
|
||||
label.setForeground(Color.BLUE);
|
||||
this.add(this.artists = label = new JLabel("Artists"));
|
||||
label.setForeground(Color.BLUE);
|
||||
this.add(this.albums = label = new JLabel("Albums"));
|
||||
label.setForeground(Color.BLUE);
|
||||
this.add(this.genres = label = new JLabel("Genres"));
|
||||
label.setForeground(Color.BLUE);
|
||||
this.add(this.years = label = new JLabel("Years"));
|
||||
label.setForeground(Color.BLUE);
|
||||
this.add(new JLabel("\u23AF\u23AF\u23AF\u23AF\u23AF\u23AF"));
|
||||
this.add(this.playlists = label = new JLabel("Playlists"));
|
||||
label.setForeground(Color.BLUE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2021 William Hubbard. All Rights Reserved.
|
||||
*/
|
||||
|
||||
package edu.regis.universe_player.player;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
/**
|
||||
* The Interface class serves as the primary GUI that the player interacts with.
|
||||
* @author William Hubbard
|
||||
* @version 0.1
|
||||
*/
|
||||
public class Interface extends JFrame
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Interface inter = new Interface();
|
||||
inter.pack();
|
||||
inter.setVisible(true);
|
||||
}
|
||||
|
||||
public Interface()
|
||||
{
|
||||
super();
|
||||
this.setTitle("Universal Music Player");
|
||||
this.getContentPane().setLayout(new BorderLayout());
|
||||
this.getContentPane().add(new Collections(), BorderLayout.LINE_START);
|
||||
this.getContentPane().add(new PlayerControls(), BorderLayout.PAGE_END);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2021 William Hubbard. All Rights Reserved.
|
||||
*/
|
||||
|
||||
package edu.regis.universe_player.player;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JSlider;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
/**
|
||||
* This panel contains the buttons necessary for controlling the playback of audio.
|
||||
*
|
||||
* @author William Hubbard
|
||||
* @version 0.1
|
||||
*/
|
||||
public class PlayerControls extends JPanel
|
||||
{
|
||||
private JButton playButton;
|
||||
private JButton nextButton;
|
||||
private JButton prevButton;
|
||||
private JSlider progress;
|
||||
|
||||
public PlayerControls()
|
||||
{
|
||||
final Dimension BUTTON_SIZE = new Dimension(32, 32);
|
||||
final Dimension ICON_SIZE = new Dimension(16, 16);
|
||||
ImageIcon icon;
|
||||
JButton button;
|
||||
JPanel buttonCont, progressCont;
|
||||
FlowLayout buttonLayout;
|
||||
SpringLayout progressLayout;
|
||||
|
||||
SpringLayout layout = new SpringLayout();
|
||||
this.setLayout(layout);
|
||||
|
||||
buttonLayout = new FlowLayout();
|
||||
buttonCont = new JPanel(buttonLayout);
|
||||
this.add(buttonCont);
|
||||
|
||||
button = new JButton();
|
||||
icon = new ImageIcon(this.getClass()
|
||||
.getResource("/gui/icons/skipPrev.png"), "Previous Button");
|
||||
icon.setImage(icon.getImage().getScaledInstance(ICON_SIZE.width, ICON_SIZE.height, 0));
|
||||
button.setIcon(icon);
|
||||
button.setPreferredSize(BUTTON_SIZE);
|
||||
buttonCont.add(button);
|
||||
this.prevButton = button;
|
||||
|
||||
button = new JButton();
|
||||
icon = new ImageIcon(this.getClass().getResource("/gui/icons/play.png"), "Play Button");
|
||||
icon.setImage(icon.getImage().getScaledInstance(ICON_SIZE.width, ICON_SIZE.height, 0));
|
||||
button.setIcon(icon);
|
||||
button.setPreferredSize(BUTTON_SIZE);
|
||||
buttonCont.add(button);
|
||||
this.playButton = button;
|
||||
|
||||
button = new JButton();
|
||||
icon = new ImageIcon(this.getClass().getResource("/gui/icons/skipNext.png"), "Next Button");
|
||||
icon.setImage(icon.getImage().getScaledInstance(ICON_SIZE.width, ICON_SIZE.height, 0));
|
||||
button.setIcon(icon);
|
||||
button.setPreferredSize(BUTTON_SIZE);
|
||||
buttonCont.add(button);
|
||||
this.nextButton = button;
|
||||
|
||||
progressLayout = new SpringLayout();
|
||||
progressCont = new JPanel(progressLayout);
|
||||
this.add(progressCont);
|
||||
|
||||
this.progress = new JSlider();
|
||||
this.add(this.progress);
|
||||
|
||||
layout.putConstraint(SpringLayout.NORTH, buttonCont, 0, SpringLayout.NORTH, this);
|
||||
layout.putConstraint(SpringLayout.WEST, buttonCont, 0, SpringLayout.WEST, this);
|
||||
layout.putConstraint(SpringLayout.NORTH, this.progress, 5, SpringLayout.SOUTH, buttonCont);
|
||||
layout.putConstraint(SpringLayout.WEST, this.progress, 5, SpringLayout.WEST, this);
|
||||
layout.putConstraint(SpringLayout.EAST, this, 5, SpringLayout.EAST, this.progress);
|
||||
layout.putConstraint(SpringLayout.SOUTH, this, 5, SpringLayout.SOUTH, this.progress);
|
||||
layout.putConstraint(SpringLayout.EAST, buttonCont, 0, SpringLayout.EAST, this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user