import java.awt.*; import javax.swing.*; public class Demo2GUIMain extends JFrame { private String[] songs = { "Drive My Car -Beatles", "Kid Charlemagne -Steely Dan", "This Love - Maroon 5", "Soul Meets Body -Death Cab for Cutie", "Float On - Modest Mouse", "Feelings - Gemini", "Stayin' Alive -Bee Gees", "Doctor My Eyes - Jackson Browne", "Peaceful Easy Feeling - The Eagles", "Spooky - Classics IV", "Tush - ZZ-top", "Who's Been Talking - Howlin Wolf" }; //Panel dimensions for main window int PANEL_WIDTH = 500; //width of the main window panel int PANEL_HEIGHT = 300; //height of the main window panel public Demo2GUIMain(String title) { super(title); setDefaultCloseOperation(EXIT_ON_CLOSE); setResizable(false); //make window non-resizeable getContentPane().setLayout(null); //use no layout management getContentPane().setPreferredSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT)); pack(); //set window size to fit content pane final int TRANSPORT_HEIGHT = 100; //These are the panels that must appear on the window VolumePanel volumeControl = new VolumePanel(PANEL_WIDTH/3, PANEL_HEIGHT-TRANSPORT_HEIGHT); volumeControl.setLocation(PANEL_WIDTH*2/3, 0); this.getContentPane().add(volumeControl); } public static void main(String args[]) { Demo2GUIMain frame = new Demo2GUIMain("ROCK-OLA Media Player"); //create the window frame.setVisible(true); //show the window } }