Gitlab@Informatics
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OXOOP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ooptest
OXOOP
Commits
18690e77
Commit
18690e77
authored
2 years ago
by
63160228
Browse files
Options
Downloads
Patches
Plain Diff
tor
parent
88b6a2bf
Branches
master
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/com/zack/oxoop/OXGameUI.java
+44
-0
44 additions, 0 deletions
src/main/java/com/zack/oxoop/OXGameUI.java
with
44 additions
and
0 deletions
src/main/java/com/zack/oxoop/OXGameUI.java
+
44
−
0
View file @
18690e77
...
@@ -4,6 +4,14 @@
...
@@ -4,6 +4,14 @@
*/
*/
package
com.zack.oxoop
;
package
com.zack.oxoop
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.ObjectInputStream
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
/**
/**
*
*
* @author acer
* @author acer
...
@@ -17,9 +25,45 @@ public class OXGameUI extends javax.swing.JFrame {
...
@@ -17,9 +25,45 @@ public class OXGameUI extends javax.swing.JFrame {
initComponents
();
initComponents
();
this
.
o
=
new
Player
(
'O'
);
this
.
o
=
new
Player
(
'O'
);
this
.
x
=
new
Player
(
'X'
);
this
.
x
=
new
Player
(
'X'
);
load
();
showWelcome
();
showWelcome
();
newGame
();
newGame
();
}
}
private
void
load
(){
FileInputStream
fis
=
null
;
try
{
File
file
=
new
File
(
"players.dat"
);
fis
=
new
FileInputStream
(
file
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
fis
);
o
=(
Player
)
ois
.
readObject
();
x
=(
Player
)
ois
.
readObject
();
// System.out.println(o);
// System.out.println(x);
ois
.
close
();
fis
.
close
();
}
catch
(
FileNotFoundException
ex
)
{
o
=
new
Player
(
'o'
);
x
=
new
Player
(
'o'
);
}
catch
(
IOException
ex
)
{
}
catch
(
ClassNotFoundException
ex
)
{
}
finally
{
try
{
if
(
fis
!=
null
){
fis
.
close
();
}
}
catch
(
IOException
ex
)
{
}
}
System
.
out
.
println
(
o
);
System
.
out
.
println
(
x
);
}
/**
/**
* This method is called from within the constructor to initialize the form.
* This method is called from within the constructor to initialize the form.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment