-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcon.java
More file actions
46 lines (39 loc) · 1.27 KB
/
con.java
File metadata and controls
46 lines (39 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package sample;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import java.io.*;
import java.nio.Buffer;
public class Controller {
@FXML private Button btnOk;
@FXML private TextField txtLogin;
@FXML private TextField txtHaslo;
@FXML private Text txtKomunikat;
@FXML
private void handleButtonAction(ActionEvent event) {
if((txtLogin.getText().equals("miq")) && (txtHaslo.getText().equals("miq"))) {
txtKomunikat.setFill(Color.GREEN);
txtKomunikat.setText("Zalogowano!");
}
else {
txtKomunikat.setFill(Color.RED);
txtKomunikat.setText("Niepoprawny login lub hasło");
}
sprawdzLogin("miq", "miq");
}
private int sprawdzLogin(String userLogin, String userHaslo) {
String currentLine;
try {
BufferedReader reader = new BufferedReader(new FileReader("src/sample/users.txt"));
currentLine = reader.readLine();
System.out.println(currentLine);
}
catch (IOException e) {
System.out.println("Nie znaleziono pliku");
}
return 1;
}
}