added merge tu grid Panel

moved borders to external components
added text field for one line with select
This commit is contained in:
Macocian Adrian Radu
2020-04-27 17:32:34 +03:00
parent 2e4d83085a
commit 202610764b
29 changed files with 546 additions and 187 deletions

0
src/Sudoku/Layout Normal file
View File

View File

@@ -0,0 +1,37 @@
package Sudoku;
import guiTree.Animations.ColorAnimation;
import guiTree.Components.ToggleButton;
import guiTree.events.KeyAdapter;
import java.awt.*;
import java.awt.event.KeyEvent;
public class SudokuButton extends ToggleButton {
private int number;
private boolean entered;
private boolean fixed;
private boolean toggle;
public SudokuButton(Boolean fixed) {
super();
this.fixed = fixed;
if(!fixed) {
addKeyListener(new SudokuKeyListener());
}
}
private class SudokuKeyListener extends KeyAdapter {
@Override
public void keyPressed(KeyEvent keyEvent) {
if(keyEvent.getKeyCode() >= 48 && keyEvent.getKeyCode() <= 57) {
setLabel(String.valueOf(keyEvent.getKeyCode() - 48));
}
else {
addAnimation(new ColorAnimation(SudokuButton.this, Color.RED, getBackgroundColor(), 100));
}
setPressed(false);
update();
}
}
}

View File

@@ -0,0 +1,28 @@
package Sudoku;
public class SudokuLayout {
public static String grid1 = "----3--67";
public static String grid2 = "-------35";
public static String grid3 = "---16---4";
public static String grid4 = "6-8-9---2";
public static String grid5 = "12--8--79";
public static String grid6 = "9---3-8-6";
public static String grid7 = "8---26---";
public static String grid8 = "69-------";
public static String grid9 = "35--9----";
public static String getGrid(int nr) {
switch(nr) {
case 1: return grid1;
case 2: return grid2;
case 3: return grid3;
case 4: return grid4;
case 5: return grid5;
case 6: return grid6;
case 7: return grid7;
case 8: return grid8;
case 9: return grid9;
}
return null;
}
}