Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
JTankTrouble
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9831111
JTankTrouble
Commits
999f0792
Commit
999f0792
authored
Jul 22, 2020
by
9831111
🙂
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add initRemindMe method.
parent
ae240047
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
3 deletions
+24
-3
LoginFrame.java
src/LoginFrame.java
+24
-3
No files found.
src/LoginFrame.java
View file @
999f0792
...
@@ -28,12 +28,13 @@ public class LoginFrame extends JFrame {
...
@@ -28,12 +28,13 @@ public class LoginFrame extends JFrame {
setLayout
(
new
BorderLayout
());
setLayout
(
new
BorderLayout
());
setBounds
(
700
,
250
,
320
,
515
);
setBounds
(
700
,
250
,
320
,
515
);
initLoginFrame
();
initLoginFrame
();
//
initRemindMe();
initRemindMe
();
// initInformationPanel();
// initInformationPanel();
setVisible
(
true
);
setVisible
(
true
);
}
}
public
void
initLoginFrame
()
{
public
void
initLoginFrame
()
{
tankPhoto
=
new
ImageIcon
(
"gifFiles/gif.gif"
);
tankPhoto
=
new
ImageIcon
(
"gifFiles/gif.gif"
);
...
@@ -65,6 +66,24 @@ public class LoginFrame extends JFrame {
...
@@ -65,6 +66,24 @@ public class LoginFrame extends JFrame {
}
}
public
void
initRemindMe
()
{
File
accounts
=
new
File
(
"Accounts.txt"
);
try
(
Scanner
scanner
=
new
Scanner
(
new
FileReader
(
accounts
)))
{
String
account
;
while
(
scanner
.
hasNextLine
())
{
account
=
scanner
.
nextLine
()
+
"\n"
;
String
[]
strings
=
account
.
split
(
" "
);
if
(
account
.
contains
(
"true"
))
{
remindMe
.
setSelected
(
true
);
userName
.
setText
(
strings
[
0
]);
passwordField
.
setText
(
strings
[
1
]);
}
}
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
}
public
void
signUpUser
(
File
accounts
)
{
public
void
signUpUser
(
File
accounts
)
{
try
(
FileWriter
fileWriter
=
new
FileWriter
(
accounts
,
true
))
{
try
(
FileWriter
fileWriter
=
new
FileWriter
(
accounts
,
true
))
{
fileWriter
.
write
(
userName
.
getText
()
+
" "
+
passwordField
.
getText
()
+
" "
+
remindMe
.
isSelected
()
+
" 0 0 0 0 0 "
+
"\n"
);
fileWriter
.
write
(
userName
.
getText
()
+
" "
+
passwordField
.
getText
()
+
" "
+
remindMe
.
isSelected
()
+
" 0 0 0 0 0 "
+
"\n"
);
...
@@ -77,6 +96,7 @@ public class LoginFrame extends JFrame {
...
@@ -77,6 +96,7 @@ public class LoginFrame extends JFrame {
}
}
}
}
public
void
signInUser
()
{
public
void
signInUser
()
{
File
accounts
=
new
File
(
"Accounts.txt"
);
File
accounts
=
new
File
(
"Accounts.txt"
);
try
(
Scanner
scanner
=
new
Scanner
(
new
FileReader
(
accounts
)))
{
try
(
Scanner
scanner
=
new
Scanner
(
new
FileReader
(
accounts
)))
{
...
@@ -103,12 +123,14 @@ public class LoginFrame extends JFrame {
...
@@ -103,12 +123,14 @@ public class LoginFrame extends JFrame {
}
}
}
}
class
SignInAction
implements
ActionListener
{
class
SignInAction
implements
ActionListener
{
@Override
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
public
void
actionPerformed
(
ActionEvent
e
)
{
signInUser
();
signInUser
();
}
}
}
}
class
SignUpAction
implements
ActionListener
{
class
SignUpAction
implements
ActionListener
{
@Override
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
public
void
actionPerformed
(
ActionEvent
e
)
{
...
@@ -132,5 +154,4 @@ public class LoginFrame extends JFrame {
...
@@ -132,5 +154,4 @@ public class LoginFrame extends JFrame {
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment