mirror of
https://github.com/macocianradu/javaGUItoolkit.git
synced 2026-03-18 21:50:04 +00:00
added merge tu grid Panel
moved borders to external components added text field for one line with select
This commit is contained in:
0
src/Sudoku/Layout
Normal file
0
src/Sudoku/Layout
Normal file
37
src/Sudoku/SudokuButton.java
Normal file
37
src/Sudoku/SudokuButton.java
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
28
src/Sudoku/SudokuLayout.java
Normal file
28
src/Sudoku/SudokuLayout.java
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user