-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 164f0cf
Showing
7 changed files
with
630 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>Sudoku</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package grid; | ||
|
||
import java.awt.Color; | ||
import java.awt.Font; | ||
import java.awt.Graphics; | ||
|
||
public class Cell { | ||
|
||
private String c; | ||
private int x,y; | ||
|
||
private int row,col; | ||
|
||
private int p=2; | ||
private int p2=4; | ||
private int size=40; | ||
|
||
private boolean selected = false; | ||
|
||
private boolean original = false; | ||
|
||
public Cell(int i,int j){ | ||
this.c = " "; | ||
this.row = i; | ||
this.col = j; | ||
this.x = p * (j - (int)(j/3)) + p2 * ((int)(j/3) + 1) + j * size; | ||
this.y = p * (i - (int)(i/3)) + p2 * ((int)(i/3) + 1) + i * size; | ||
} | ||
|
||
public void original(){ | ||
this.original = true; | ||
} | ||
|
||
public boolean isOriginal(){ | ||
return original; | ||
} | ||
|
||
public boolean contains(int x,int y){ | ||
return (x > this.x && x < this.x + size && y > this.y && y < this.y + size); | ||
} | ||
|
||
public int getRow(){ | ||
return row; | ||
} | ||
public int getCol(){ | ||
return col; | ||
} | ||
|
||
public String getRowCol(){ | ||
return ("row " + (row+1) + ", col "+(col+1)); | ||
} | ||
|
||
public void setValue(String c){ | ||
this.c = c; | ||
} | ||
|
||
public String getValue(){ | ||
return c; | ||
} | ||
|
||
public void select(){ | ||
selected = true; | ||
} | ||
|
||
public boolean isSelected(){ | ||
return selected; | ||
} | ||
|
||
public void draw(Graphics g){ | ||
g.fillRect(x, y, size, size); | ||
g.setColor(Color.BLACK); | ||
if(!original) | ||
g.setFont(new Font("Century Gothic",Font.PLAIN, 30)); | ||
else | ||
g.setFont(new Font("Century Gothic",Font.BOLD, 30)); | ||
g.drawString(c, x + size - 30, y + size - 10); | ||
} | ||
|
||
} |
Oops, something went wrong.