building is done - arrange the components tForeground(new Color(0,85,150)) ĬenterPane.add(infoLabel, BorderLayout.CENTER) ĬenterPane.add(new JLabel(" "), BorderLayout.SOUTH) ĬontentPane.add(centerPane, BorderLayout.EAST) īutton.addActionListener(new ActionListener() ĬontentPane.add(toolbar, BorderLayout.NORTH) tHorizontalAlignment(SwingConstants.CENTER) JLabel image = new JLabel(new ImageIcon("title.jpg")) ĬenterPane.add(image, BorderLayout.NORTH)
![frames in bluegriffon frames in bluegriffon](http://www.bluegriffon-epubedition.com/BG_files/screenshot_2.png)
Create the center with image, text label, and sliderĬtLayout(new BorderLayout(8, 8)) LeftPane.add(scrollPane, BorderLayout.CENTER) ĬontentPane.add(leftPane, BorderLayout.CENTER) JScrollPane scrollPane = new JScrollPane(fileList) Create the scrolled list for file namesįileList = new JList(tracks.asStrings()) įtForeground(new Color(212,212,255)) įtBackground(new Color(0,85,150)) įtSelectionBackground(new Color(212,212,255)) įtSelectionForeground(new Color(0,45,75)) Create the left side with combobox and scroll list Specify the layout manager with nice spacingĬtLayout(new BorderLayout(8, 8)) JPanel contentPane = (JPanel)getContentPane() ĬtBorder(new EmptyBorder(6, 10, 10, 10)) the following makes sure that our application exits when - Swing stuff to build the frame and all its components and menus. Int selected = fileList.getSelectedIndex() Public void valueChanged(ListSelectionEvent evt) Called when the user select an entry in the track list. + "Average track time: " + player.averageTrackLength() + "Total track time: " + player.getTotalPlayedTrackLength() + "\n" + "Total tracks played: " + player.getNumberOfTracksPlayed() + "\n" String text = "kSound\n" + VERSION + "\n" CHALLENGE TASK: REMOVE THE LINE ABOVE, AND UNCOMMENT THE FOLLOWING 4 LINES: * Stop the currently playing sound file (if there is one playing). * Display information about a selected sound file (name and clip length). * selection in the list, or if the selected file is not a sound file, * Play the sound file currently selected in the file list. * Create a SoundPlayer and display its GUI on screen. Private static final String VERSION = "Version 1.0" Public class SoundPlayerGUI extends JFrame * The sound player can play sound clips in WAV, AU and AIFF formats To start, create an instance of this class. NewClip = (Clip) AudioSystem.getLine(info) Stream = AudioSystem.getAudioInputStream(tmp, stream) ĭataLine.Info info = new DataLine.Info(Clip.class, we cannot play ALAW/ULAW, so we convert them to PCM * The sound clip if successful, null if the file could not be decoded.ĪudioInputStream stream = AudioSystem.getAudioInputStream(file) * Load the sound file supplied by the parameter. * Return true if this track has successfully loaded and can be played. * vol Volume level as a percentage (0.100). * Set the playback volume of the current track. Return (int) soundClip.getMicrosecondLength()/1000000 * Return the duration of this track, in seconds. (This method has no effect if the track is not (The sound will play asynchronously, until * Watch out, once a track has been played, it can only be played again * not all WAV files - it depends on the encoding in the file). * The track accepts files in WAV, AIFF, and AU formats (although * and the track object can then be used to control the sound. The track can be instantiated with a valid sound file, * Return this playlist as an array of strings with the track names. ("Error: " + dirName + " must be a directory")
![frames in bluegriffon frames in bluegriffon](https://imag.malavida.com/mvimg/main-m/bluegriffon-23919-1.jpg)
* Load the file names of all files in the given directory. * Return the number of tracks in this collection. * Constructor for objects of class TrackCollection
![frames in bluegriffon frames in bluegriffon](https://images.sftcdn.net/images/t_app-cover-m,f_auto/p/ff4d25d0-9b2a-11e6-9b7c-00163ed833e7/1481728941/bluegriffon-screenshot.jpg)
* Write a description of class Player here.
![frames in bluegriffon frames in bluegriffon](https://i.pinimg.com/236x/ac/43/b8/ac43b8e8a4eb5d51ad7937db1a258719--manual.jpg)
This is a bluej assignment, not asking for you to do my school assignment, i just need a "push" in the right direction :) So i am not really sure what to do, any help would be appreciated thanks :) So back to my post, trying to figure out what i am doing wrong, and why my class wont compile. Yes i do know this have been posted atleast two times before, but i can hardly get anyhelp out of it.