-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFitDriver.java
55 lines (41 loc) · 2.08 KB
/
FitDriver.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import java.awt.event.ActionEvent;
import javax.swing.JComboBox;
public class FitDriver {
public static void main(String[] args) {
new FitGUI(); //call the GUI stored in FitGUI.java
//GUI prompt: user clicks Get Started button, goes to next panel asking
//which exercise they will be focusing on today with drop down menu option selection
//--do we need all possible ddm option selections stored in a container/arrayList?
//String object created from selection using method below (should be in GUI class)
//String object becomes query to API class method once passed
//majority, if not all, of this program can be ran through GUI class/prompts
//need to work on output possibilities -- embedding videos in final panel?
//but should test output through console first:
System.out.println(youtubeAPI);
//String obj ran through Youtube Data API as search query should return in JSON
//do we parse JSON with a parsing library or try to have the GUI
//display API class output as URLs or embedded videos?
//https://docs.oracle.com/javase/7/docs/api/java/awt/event/ActionListener.html
public void actionPerformed(ActionEvent e) { //Performed vs Listener? Event handler
JComboBox<Item> comboBox = (JComboBox<Item>) e.getSource();
Item item1 = (Item) comboBox.getSelectedItem();
//String object created from GUI class combo box selection needs to be passed
//to API class/ API method...have API method call that String object
//refer to setQ(String obj);
//
//
}
}
YouTube.Search.List search = youtube.search().list("id,snippet");
String apiKey = properties.getProperty("youtube.apikey");
search.setKey(apiKey);
//Method to set query
search.setQ(queryTerm);
// Call the API and print results.
public static JSONObject jsonObject = null;
public static Properties properties = null;
SearchListResponse searchResponse = search.execute();
List<SearchResult> searchResultList = searchResponse.getItems();
if (searchResultList != null) {
prettyPrint(searchResultList.iterator(), queryTerm);
}