Merge remote-tracking branch 'origin/master'
# Conflicts: # src/main/java/seng202/group9/GUI/MenuController.java
This commit is contained in:
+5
-1
@@ -1,2 +1,6 @@
|
|||||||
This is a Flight Application Data Analyser. It runs on Java and has dependencys JavaFX and Maven.
|
This is a Flight Application Data Analyser. It runs on Java and has dependencys JavaFX, SQLITE3 and Maven.
|
||||||
If you are using Eclipse as an IDE please follow the instructions on http://www.eclipse.org/efxclipse/install.html to add JavaFX Library.
|
If you are using Eclipse as an IDE please follow the instructions on http://www.eclipse.org/efxclipse/install.html to add JavaFX Library.
|
||||||
|
|
||||||
|
To Import this project:
|
||||||
|
git clone https://eng-git.canterbury.ac.nz/fwy13/SENG202.git
|
||||||
|
Open your preferred IDE and then Import Maven Project.
|
||||||
Binary file not shown.
@@ -1,12 +1,21 @@
|
|||||||
package seng202.group9.Controller;
|
package seng202.group9.Controller;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.fxml.JavaFXBuilderFactory;
|
||||||
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.Menu;
|
||||||
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import seng202.group9.GUI.MainMenuBar;
|
import seng202.group9.GUI.MenuController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main Application frame of the Flight Data Analyser.
|
* Main Application frame of the Flight Data Analyser.
|
||||||
@@ -16,6 +25,7 @@ public class App extends Application
|
|||||||
{
|
{
|
||||||
private ArrayList<Dataset> Datasets = new ArrayList<Dataset>();
|
private ArrayList<Dataset> Datasets = new ArrayList<Dataset>();
|
||||||
private Dataset currentDataset = null;
|
private Dataset currentDataset = null;
|
||||||
|
private Stage primaryStage = null;
|
||||||
|
|
||||||
public static void main( String[] args )
|
public static void main( String[] args )
|
||||||
{
|
{
|
||||||
@@ -27,14 +37,14 @@ public class App extends Application
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) {
|
public void start(Stage primaryStage) {
|
||||||
BorderPane root = new BorderPane(); //root panel
|
this.primaryStage = primaryStage;
|
||||||
Scene scene = new Scene(root,400,400);
|
try {
|
||||||
//create the menu
|
MenuController menuController = new MenuController();
|
||||||
MainMenuBar menuBar = new MainMenuBar();
|
menuController.setApp(this);
|
||||||
root.setTop(menuBar.getmenuBar());
|
replaceSceneContent("menu.fxml");//replace this to check your fxml file
|
||||||
//TODO add the getting started page here.
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
primaryStage.setScene(scene);
|
}
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
//testing out dataset
|
//testing out dataset
|
||||||
try {
|
try {
|
||||||
@@ -62,6 +72,30 @@ public class App extends Application
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace Scene Content with fxml file code from oracle.
|
||||||
|
* @param fxml
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public Initializable replaceSceneContent(String fxml) throws Exception {
|
||||||
|
FXMLLoader loader = new FXMLLoader();
|
||||||
|
InputStream in = getClass().getClassLoader().getResourceAsStream(fxml);
|
||||||
|
InputStream menuIn = getClass().getClassLoader().getResourceAsStream("menu.fxml");
|
||||||
|
VBox page;
|
||||||
|
try {
|
||||||
|
page = (VBox) loader.load(menuIn);
|
||||||
|
Parent content = loader.load(getClass().getClassLoader().getResource(fxml));
|
||||||
|
page.getChildren().add(content);
|
||||||
|
} finally {
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
Scene scene = new Scene(page, 800, 600);
|
||||||
|
primaryStage.setScene(scene);
|
||||||
|
primaryStage.sizeToScene();
|
||||||
|
return (Initializable) loader.getController();
|
||||||
|
}
|
||||||
|
|
||||||
public Dataset getCurrentDataset(){
|
public Dataset getCurrentDataset(){
|
||||||
return currentDataset;
|
return currentDataset;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
package seng202.group9.GUI;
|
|
||||||
|
|
||||||
import javafx.fxml.FXMLLoader;
|
|
||||||
import javafx.scene.Parent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main Menu Bar for the program
|
|
||||||
* @author YaFedImYaEatIm
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class MainMenuBar{
|
|
||||||
|
|
||||||
final private String menuFXML = "menu.fxml";
|
|
||||||
|
|
||||||
public Parent getmenuBar(){
|
|
||||||
try{
|
|
||||||
Parent menuPane = FXMLLoader.load(getClass().getClassLoader().getResource(menuFXML));
|
|
||||||
return menuPane;
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user