-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisplay.java
More file actions
63 lines (54 loc) · 1.69 KB
/
Display.java
File metadata and controls
63 lines (54 loc) · 1.69 KB
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
56
57
58
59
60
61
62
63
import java.io.IOException;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import org.jsoup.nodes.Element;
public class Display extends Application{
private Stage primaryStage;
private Scene mainScene;
private BorderPane root;
//Menu bar for the entire app
private MenuBar menuBar;
private final Menu popMang = new Menu("Popular Manga");
//Handles retrieving all of the information from the website
private PandaRetriever pr;
//Displaying popular manga names
private ListView nameList;
public static void main(String[] args){
launch(args);
}
public void start(Stage primaryStage) throws Exception{
this.primaryStage = primaryStage;
primaryStage.setTitle("Mango - The Manga Viewer");
root = new BorderPane();
menuBar = new MenuBar();
root.setTop(menuBar);
menuBar.getMenus().add(popMang);
mainScene = new Scene(root, 600, 600);
primaryStage.setScene(mainScene);
primaryStage.show();
loadWebData();
root.setCenter(nameList);
}
//Uses the PandaRetriever to get all of the information necessary that needs to be displayed to
//the listviews
public void loadWebData(){
try{
pr = new PandaRetriever();
}catch(IOException e){
e.printStackTrace();
}
nameList = new ListView(pr.getPopMangaNames());
nameList.setOnMouseClicked(new EventHandler<MouseEvent>(){
public void handle(MouseEvent e) {
pr.generateChaptersPage((String) nameList.getSelectionModel().getSelectedItem());
}
});
}
}