Join Carlos Rivas for an in-depth discussion in this video Implement the music player, part of Code Clinic: Java.
- [Instructor] Before proceeding,…be sure to go to the Exercise Files folder…and open up the Starter Projects,…Chapter 4,…and open up the peripherals folder…in your favorite Java IDE.…We're using Visual Studio Code here,…so let's go there now.…Okay, so we have created an instance of our music player,…and as line 31 shows,…we also have the call to our play method.…It takes two input values,…volume and pitch.…
What we'll do now is change pitch…based on the mouse Y positions relative to the screen…and set volume based on the X-axis position.…Let's do that now.…We'll start by getting the mouse location information,…which we can do by calling getPointerInfo…and then calling getLocation.…
Next we need to know where are on the screen.…So we're going to have a variable called screenSize…and we're going to call the getScreenSize method…of the default Java toolkit.…And then let's call our getScreenSize method.…Now, these values are not numbers.…They're data structures.…
So we need to parse those into the values…that we actually can use.…
Visit other courses in the series to see how to solve the exact same challenges in languages like C#, C++, PHP, Python, and Ruby.
Skill Level Intermediate
1. Problem 1: Pond Oreille
2. Problem 2: Where Am I?
3. Problem 3: Eight Queens
4. Problem 4: Accessing Peripherals
5. Problem 5: Facial Recognition
6. Problem 6: Real-Time Information Dashboard
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.