import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class sudoku1 extends Frame implements ActionListener,KeyListener {
int i,j;
int x,y;
Button b;
Graphics g;
sudoku1(String s)
{
super(s);
setTitle("Sudoku");
setSize(1000,700);
addKeyListener(this);
b=new Button("New Game");
setLayout(new BorderLayout());
b.addActionListener(this);
add(b,BorderLayout.SOUTH);
addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){System.exit(0);}});
setVisible(true);
g=getGraphics();
}
/*public void control(KeyEvent e)
{
if(e.getKeyCode()==VK_ENTER)
JOptionPane.showMessageDialog(null,"right");
}*/
public void keyPressed(KeyEvent e)
{
if(e.getKeyCode()==VK_RIGHT)
JOptionPane.showMessageDialog(null,"right");
}
public void keyReleased(KeyEvent e){}
public void keyTyped(KeyEvent e){}
public void draw()
{
g.setColor(Color.BLUE);
x=500;
y=350;
i=j=0;
while(i<10) //platform of the game is printed on screen.
{
g.drawLine(x-270+60*i,y-270,x-270+60*i,y+270);
g.drawLine(x-270,y-270+60*i,x+270,y-270+60*i);
if(i==3||i==6)
{
g.drawLine(x-270+60*i+2,y-270,x-270+60*i+2,y+270);
g.drawLine(x-270,y-270+60*i+2,x+270,y-270+60*i+2);
}
i++;
}
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b)
draw();
}
public static void main(String[] args) {
// TODO code application logic here
sudoku1 m=new sudoku1("Sudoku");
}
}