Its pretty standard, why the hell isnt the window showing?? Cant figure it out :(
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
public class GUIpart {
//All ze variables required
int tempboard[][]=new int[9][9];
SudokuBoard fresh= new SudokuBoard();
JFrame sudoku = new JFrame("Srik Sudoku");
JFormattedTextField guiboard[][] = new JFormattedTextField[9][9];
public void GUIpart(){
sudoku.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel grids = new JPanel();
grids.setLayout(new GridLayout(10,9));
try{
MaskFormatter format=new MaskFormatter("#");
for(int i=0;i<9;i++){
for(int j=0;j<9;j++){
guiboard[i][j]=new JFormattedTextField(format);
guiboard[i][j].setColumns(1);
grids.add(guiboard[i][j]);
}
}
}
catch(Exception e){
System.out.println("Jai");
}
JButton solve = new JButton("Solve");
solve.addActionListener(new solveActionListener());
grids.add(solve);
sudoku.getContentPane().add(grids);
sudoku.pack();
sudoku.setVisible(true);
}
public static void gogui(){
JFrame.setDefaultLookAndFeelDecorated(true);
GUIpart yay= new GUIpart();
}
private class solveActionListener implements ActionListener{
public void actionPerformed(ActionEvent e){
for(int i=0;i<9;i++){
for(int j=0;j<9;j++){
tempboard[i][j]=Integer.parseInt(guiboard[i][j].getText());
}
}
fresh.inputBoard(tempboard);
fresh.generateSolution();
tempboard=fresh.sendBoard();
for(int i=0;i<9;i++){
for(int j=0;j<9;j++){
guiboard[i][j].setText(Integer.toString(tempboard[i][j]));
}
}
}
}
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
gogui();
}
});
}
}