Skip to content

Commit

Permalink
New commit 22/02/2017 at 2:12
Browse files Browse the repository at this point in the history
  • Loading branch information
xxMrPHDxx committed Feb 21, 2017
0 parents commit 164f0cf
Show file tree
Hide file tree
Showing 7 changed files with 630 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .classpath
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>
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions .project
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>
11 changes: 11 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
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
79 changes: 79 additions & 0 deletions src/grid/Cell.java
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);
}

}
Loading

0 comments on commit 164f0cf

Please sign in to comment.