/JavaFX-Sample-Temperature-App

Sample JavaFX Project for CIS 111B

Primary LanguageJava

JavaFX Sample Temperature App

Sample JavaFX Project for CIS 111B. Use this as a reference when building and working on your final projects.

Important Files

  • TempAppMain.java - Contains the main method and code to load the FXML file for the initial scene.
  • FXMLTempAppController.java - The bulk of the program code is found here. This is the main Java file that is "tied" to the FXML document. This contains the methods that are run when buttons are pushed as well as the code to access the API.
  • Temperature.java - This is the top-level of the class heirarchy used to store API data for use in the app. This class heirarchy is used by GSON to create a plain-old-java-object (POJO) that can be utilized in the program. Other classes utilized in this heirarchy include Main.java.
  • MainView.fxml - This is the file generated by Scene Builder that contains all of the information for displaying the UI and for linking the UI components to the FXMLTempAppController.java file.
  • styles.css - A CSS file linked to in Scene Builder to style some app components. There is a tutorial for using JavaFX CSS as well as a full JavaFX CSS Reference Guide.
  • ReferenceAPIData.json - An example of the JSON returned by the weather API that is being parsed by GSON. This can help you understand the mapping of the JSON to the class heirarchy that begins with Temperature.java.

Notes

  • This project is configured to work with the JGrasp IDE.
  • The API key is not stored in the repository. This is set by the IDE and accessed via the environment at run-time. You can not access the Weather API without getting your own account and your own API key. This is not required. The program will run, it just won't access the API.
  • The repostiory includes the required libraries. This is a choice to make this more portable and to make configuration tutorials more straight-forward.