Hi i am new in java. I am trying to create sudoku application bot I am strugling to connect classes
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.DisplayMode;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class MySudoku
{
public static byte[][] sudoku = new byte[729][82]; //global array for sudoku solution
public static byte step = 0; //global variable for solution step
private static final int WindowWidth = 777; //its 777 pixels wide
private static final int WindowHeight = 636; //its 636 pixels high
public static void ShowGUI()
{
Smethods.start(sudoku); //start array at step 0 has no numbers selected
final byte border = 14; //border for display
JFrame f = new JFrame("MySudoku");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
BufferedImage image = null;
try {
image = ImageIO.read(new File("sudoku.png"));
} catch (IOException e) {
}//end of try/catch
f.setResizable(false); //not to be resized
f.setIconImage(image);
f.setSize(WindowWidth, WindowHeight); //size fixed by size of display and borders
f.setLocation(0, 0); //start top left
f.setLayout(new BorderLayout()); //north south east west and centre
f.add(new SPanel(new Dimension(WindowWidth,border)), BorderLayout.NORTH);
f.add(new SPanel(new Dimension(WindowWidth,border)), BorderLayout.SOUTH);
f.add(new SPanel(new Dimension(border,WindowHeight)), BorderLayout.EAST);
f.add(new SPanel(new Dimension(0,WindowHeight)), BorderLayout.WEST); //set the borders
Component dp =new Component();
dp.setBackground(Color.BLACK); //set the background of the sudoku display black
f.add(dp, BorderLayout.CENTER); //add the sudoku display panel
f.setVisible(true);
}//end of show gui method
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
ShowGUI();
}
}); //end of run()
}//end of main
}//end of MySudoku class
public class Smethods
{
public static byte select(byte[][] sudoku, byte number, byte position, byte step)
{
if((sudoku[position*9 + number][step] == 0) || (sudoku[position*9 + number][step] > 9))
return step;//end of number not possible or is selected
step += 1; // we can select so write this step to the sudoku array
int count = 0;
for(count = 0; count < 729; count++)
sudoku[count][step] = sudoku[count][step - 1]; //copy existing to next step
for(count = 0; count < 9; count++)
sudoku[position*9 + count][step] = 0; //Can't select any in box
byte row = (byte) (position/9);
for(count = 0; count < 9; count++)
sudoku[row * 81 + count * 9 + number][step] = 0; //horizontal row
byte column = (byte) (position%9);
for(count = 0; count < 9; count++)
sudoku[column * 9 + count * 81 + number][step] = 0; //vertical row
int brow = (position/27)*243; //row block 0f 3
column = (byte) (((position%9)/3)*27); //Column block of 3
byte incount;
for(incount = 0; incount < 3; incount++)
{
for(count = 0; count < 3; count++)
sudoku[brow + column + count * 9 + incount * 81 + number ][step] = 0; //box of 3 x 3
}//end of 3 x 3 box
//we have selected one number
sudoku[position*9 + number][step] = (byte) (number + 11); //selected now 11 to 19
return step;
}//end of select a number//end of class
public static void start(byte[][] sudoku) {
}
public static void trysudoku(byte[][] sudoku, byte startstep) {
}