-
Notifications
You must be signed in to change notification settings - Fork 0
/
Logup.java
42 lines (33 loc) · 1.19 KB
/
Logup.java
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
package sample;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextField;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
public class Logup {
@FXML
private TextField username;
@FXML
private TextField password;
@FXML
void nlogup(ActionEvent event) throws IOException {
//vaghti roo dokme logup click mishe
if(!username.getText().equals("") && !password.getText().equals("")){//barresi mikone bbine aya input haye ma khali has ya na
Write_To_File(username.getText(),password.getText());}else {
System.out.println("null");
}
}
void Write_To_File(String username,String password) throws IOException {
//etelaate sabtenam ro vared file mikone in tabe
String s=username+","+password+"/";
try {
Files.write(Paths.get("Users.txt"),s.getBytes(), StandardOpenOption.APPEND);
Main.pager.onnext("sample");
//mirim be safhhe login
}catch (IOException e) {
System.out.println(e.getMessage());
}
}
}