Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class EssentialOils extends Application {
- File file;
- DataFile dataFile;
- ComboBox<Oil> oilName;
- ObservableList<Oil> oilList;
- InfoPane infoPane;
- @Override
- public void start(Stage primaryStage) {
- dataFile = new DataFile();
- oilList = FXCollections.observableArrayList();
- infoPane = new InfoPane();
- VBox mainButtons = new VBox();
- mainButtons.setSpacing(9.0);
- Button openButton = new OpenFile(this,dataFile);
- Button exitButton = new ExitButton();
- mainButtons.getChildren().addAll(openButton, exitButton);
- BorderPane root = new BorderPane();
- root.setRight(mainButtons);
- oilName = new ComboBox<>();
- oilName.setItems(oilList);
- oilName.setPrefWidth(300);
- new AutoCompleteComboBoxListener(oilName);
- Button loadButton = new Button("Load");
- loadButton.setOnAction(new EventHandler<ActionEvent>(){
- @Override
- public void handle(ActionEvent arg0) {
- infoPane.setOil(oilName.getValue());
- }
- });
- VBox leftSide = new VBox();
- leftSide.getChildren().addAll(oilName, loadButton);
- root.setLeft(leftSide);
- root.setCenter(infoPane);
- Scene scene = new Scene(root, 500, 400);
- primaryStage.setTitle("Essential Oil Resource");
- primaryStage.setScene(scene);
- primaryStage.show();
- }
- public void generateOilList()
- {
- System.out.println("Bout to generate");
- int n = dataFile.getOils().size();
- for(int i = 0; i < n; i++)
- {
- oilList.add(dataFile.getOil(i));
- System.out.println(oilList.get(i));
- }
- }
- /**
- * The main() method is ignored in correctly deployed JavaFX application.
- * main() serves only as fallback in case the application can not be
- * launched through deployment artifacts, e.g., in IDEs with limited FX
- * support. NetBeans ignores main().
- *
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- launch(args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement