package database; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.stage.Stage; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author lana */ public class AddInstructorController implements Initializable { @FXML public Button cancelAddButton; @FXML public Button addInstructorButton; @FXML public ComboBox title; public TextField firstName; public TextField lastName; public TextField alias; public TextField phone; public TextField office; public TextField emplID; public TextField WTUs; public TextArea notes; Stage stage; public void setStage(Stage stage) { this.stage = stage; } @Override public void initialize(URL url, ResourceBundle rb) { //To change body of generated methods, choose Tools | Templates. } @FXML private void onCancelAddButton(ActionEvent event) { stage.close(); } @FXML private void onAddInstructorButton(ActionEvent event) { String fieldFirstName = firstName.getText(); String fieldLastName = lastName.getText(); String fieldTitle = (String)title.getValue(); String fieldAlias = alias.getText(); String fieldPhone = phone.getText(); String fieldOffice = office.getText(); String fieldWtus = WTUs.getText(); String fieldEmplID = emplID.getText(); String fieldNotes = notes.getText(); try { final FXMLLoader loader = new FXMLLoader(getClass().getResource("instructorsList.fxml")); final Parent root = (Parent) loader.load(); final InstructorsListController controller = loader.getController(); Scene scene = new Scene(root); controller.addInstructor(fieldFirstName, fieldLastName, fieldTitle, fieldAlias, fieldOffice, fieldPhone, fieldWtus, fieldEmplID, fieldNotes); stage.setScene(scene); controller.setStage(stage); } catch(IOException ex) { } stage.close(); } }