הנה, אבל זה כל הקוד
(אני אשים לך **** לפני ואחרי השורה כדי שתוכל לראות)
import javax.swing.*;
import java.awt.*;
import java.lang.*;
import java.awt.event.*;
public class Draw_Game extends JFrame implements MouseListener
{
char Won='C';
private int x,y;
Board B= new Board();
public Draw_Game()
{
super ("Tic Tac Toe");
addMouseListener(this);
setSize (300,300);
setVisible(true);
}
public void paint (Graphics g)
{
super.paint(g);
int width=getSize().width;
int height=getSize().height;
g.drawLine(0, 100, height, 100);
g.drawLine(0, 200, height, 200);
g.drawLine(100, 0, 100, width);
g.drawLine(200, 0, 200, width);
for (int i=0; i < 3; i++)
for (int j=0; j < 3; j++)
if (B.board[j]!='C')
{
if ((i==0) && (j==0))
if (B.board[j]=='O')
g.drawOval(20, 30,70,70);
else
{
g.drawLine(100, 30, 0, 100);
g.drawLine(0, 24, 100, 100);
}
else if ((i==0) && (j==1))
if (B.board[j]=='O')
g.drawOval(120, 30,70,70);
else
{
g.drawLine(200, 30, 100, 100);
g.drawLine(100, 30, 200, 100);
}
else if ((i==0) && (j==2))
if (B.board[j]=='O')
g.drawOval(210, 30,70,70);
else
{
g.drawLine(300, 24, 200, 100);
g.drawLine(200, 30, 300, 100);
}
else if ((i==1) && (j==0))
if (B.board[j]=='O')
g.drawOval(20, 120, 70, 70);
else
{
g.drawLine(100, 100, 0, 200);
g.drawLine(0, 90, 100, 200);
}
else if ((i==1) && (j==1))
if (B.board[j]=='O')
g.drawOval(110, 120, 70, 70);
else
{
g.drawLine(300, 24, 200, 100);
g.drawLine(200, 30, 300, 100);
}
else if ((i==1) && (j==2))
if (B.board[j]=='O')
g.drawOval(210, 120, 70, 70);
else
{
g.drawLine(200, 100,300, 200);
g.drawLine(200, 200, 300, 90);
}
else if ((i==2) && (j==0))
if (B.board[j]=='O')
g.drawOval(20, 220, 70, 70);
else
{
g.drawLine(0, 200, 100, 300);
g.drawLine(100, 200, 0, 300);
}
else if ((i==2) && (j==1))
if (B.board[j]=='O')
g.drawOval(110, 220, 70, 70);
else
{
g.drawLine(100, 200, 200, 300);
g.drawLine(200, 200, 100, 300);
}
else if ((i==2) && (j==2))
if (B.board[j]=='O')
g.drawOval(210, 220, 70, 70);
else
{
g.drawLine(200, 200, 300, 300);
g.drawLine(300, 200, 200, 300);
}
} // if
} // paint
@Override
public void mouseClicked(MouseEvent e)
{
// while (Won=='C')
// TODO Auto-generated method stub
x=e.getX();
y=e.getY();
if ((x<=100) && (y<=100))
{
B.board[0][0]='O';
Won=B.Who_Won();
System.out.println (Won);
}
else if (((x>100) && (x<=200) && (y<=100)))
{
B.board[0][1]='O';
Won=B.Who_Won();
System.out.println (Won);
}
else if (((x>200) && (x<=300) && (y<=100)))
{
B.board[0][2]='O';
Won=B.Who_Won();
System.out.println (Won);
}
else if ((x<=100) && ((y>100) && (y<=200)))
B.board[1][0]='O';
else if (((x>100)&& (x<=200)) && ((y>100) && (y<=200)))
B.board[1][1]='O';
else if (((x>200)&& (x<=300)) && ((y>100) && (y<=200)))
B.board[1][2]='O';
else if ((x<=100) && ((y>200) && (y<=300)))
B.board[2][0]='O';
else if (((x>100)&& (x<=200)) && ((y>200) && (y<=300)))
B.board[2][1]='O';
else if (((x>200)&& (x<=300)) && ((y>200) && (y<=300)))
B.board[2][2]='O';
repaint();
}
*******************************************************
System.out.println ("hi");
********************************************************
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
}
השגיאה:
Multiple markers at this line
- Syntax error on token(s), misplaced
construct(s)
- Syntax error on token ""hi"", delete this
token
אין לי שמץ מה זה אומר, נראה לי הזוי...