Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
Mathdoku
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tmp1u19
Mathdoku
Commits
4ef9760f
Commit
4ef9760f
authored
5 years ago
by
tmp1u19
Browse files
Options
Downloads
Patches
Plain Diff
Cell class which defines a cell in the grid of the game.
parent
fb21531b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Cell.java
+63
-0
63 additions, 0 deletions
Cell.java
with
63 additions
and
0 deletions
Cell.java
0 → 100644
+
63
−
0
View file @
4ef9760f
import
javafx.geometry.Pos
;
import
javafx.scene.control.TextField
;
import
javafx.scene.layout.*
;
import
javafx.scene.control.Label
;
import
javafx.scene.text.Font
;
public
class
Cell
extends
Pane
{
private
Label
label
=
new
Label
();
private
TextField
input
;
private
int
i
;
private
int
j
;
public
Cell
(
int
n
,
int
i
,
int
j
)
{
this
.
i
=
i
;
this
.
j
=
j
;
input
=
new
TextField
();
setPrefSize
(
400
/
n
,
400
/
n
);
setStyle
(
"- fx-background-color: transparent;"
);
input
.
setStyle
(
"-fx-text-box-border: transparent; -fx-background-color: transparent;"
);
input
.
setAlignment
(
Pos
.
CENTER
);
input
.
setFont
(
Font
.
font
(
35
));
input
.
setPrefWidth
(
400
/
n
);
input
.
setPrefHeight
(
400
/
n
);
getChildren
().
add
(
input
);
}
public
void
setLabel
(
String
label
)
{
this
.
label
.
setText
(
label
);
this
.
label
.
setAlignment
(
Pos
.
TOP_LEFT
);
getChildren
().
add
(
this
.
label
);
}
public
String
getLabel
()
{
return
label
.
getText
();
}
public
TextField
getTextField
()
{
return
input
;
}
public
boolean
isNumeric
(
String
text
)
{
try
{
Integer
.
parseInt
(
text
);
return
true
;
}
catch
(
Exception
e
)
{
return
false
;
}
}
public
int
getRow
()
{
return
i
;
}
public
int
getColumn
()
{
return
j
;
}
}
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