Skip to content
Snippets Groups Projects
Commit 588fb0a6 authored by ArktikHunter's avatar ArktikHunter
Browse files

can now press enter to login

parent 89dc75da
Branches front
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ import javafx.beans.value.ChangeListener; ...@@ -5,6 +5,7 @@ import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.event.Event;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Node; import javafx.scene.Node;
...@@ -121,7 +122,7 @@ public class Controller { ...@@ -121,7 +122,7 @@ public class Controller {
Parent removeEmployeeView; Parent removeEmployeeView;
// login methods, initializes views too // login methods, initializes views too
public void attemptLogin(MouseEvent e) throws Exception { public void attemptLogin(Event e) throws Exception {
if (!model.hasEmployee(Integer.parseInt(loginField.getText()))) { if (!model.hasEmployee(Integer.parseInt(loginField.getText()))) {
loginWarning.setText("Invalid id"); loginWarning.setText("Invalid id");
} }
...@@ -130,7 +131,7 @@ public class Controller { ...@@ -130,7 +131,7 @@ public class Controller {
} }
} }
public void login(MouseEvent e) throws Exception { public void login(Event e) throws Exception {
//set this employee and manager privileges as appropriate //set this employee and manager privileges as appropriate
int thisEmployee = Integer.parseInt(loginField.getText()); int thisEmployee = Integer.parseInt(loginField.getText());
model.setThisEmployee(thisEmployee); model.setThisEmployee(thisEmployee);
...@@ -510,7 +511,7 @@ public class Controller { ...@@ -510,7 +511,7 @@ public class Controller {
} }
// other helper methods // other helper methods
public void updateCurrentDate(MouseEvent event) throws Exception { public void updateCurrentDate(Event event) throws Exception {
currentDateText.setText("Current Date: " + model.date.toString()); currentDateText.setText("Current Date: " + model.date.toString());
currentDateTextAvail.setText("Current Date: " + model.date.toString()); currentDateTextAvail.setText("Current Date: " + model.date.toString());
} }
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<Font size="18.0" /> <Font size="18.0" />
</font> </font>
</Label> </Label>
<TextField fx:id="loginField" alignment="CENTER" maxWidth="-Infinity" prefHeight="26.0" prefWidth="74.0" promptText="User ID" /> <TextField fx:id="loginField" alignment="CENTER" maxWidth="-Infinity" onAction="#attemptLogin" prefHeight="26.0" prefWidth="74.0" promptText="User ID" />
</children> </children>
</HBox> </HBox>
<Button mnemonicParsing="false" onMouseClicked="#attemptLogin" text="Login"> <Button mnemonicParsing="false" onMouseClicked="#attemptLogin" text="Login">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment