forked from fineanmol/Hacktoberfest2024
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tic-tac-toe board.java
66 lines (48 loc) · 2.03 KB
/
tic-tac-toe board.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package practical17;
import java.io.FileInputStream;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
public class Practical17 extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
GridPane root = new GridPane();
Image img;
ImageView img_view;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
int n = (int) (Math.random() * 2);
if(n==0)
{ FileInputStream fin;
fin = new FileInputStream("C://Users//SI//OneDrive//Desktop//java_image/X.gif");
//fin=("E:/x.gif");
img = new Image(fin);
img_view = new ImageView(img);
root.add(img_view, j, i);
}
else if(n==1)
{
FileInputStream fin;
//fin = new FileInputStream("C:/Users/SI/OneDrive/Desktop/BE SEM 4/05_ OBJECT ORRIENTED PROGRAMMING -1/220133107008/O.jpg");
fin = new FileInputStream("C://Users//SI//OneDrive//Desktop//java_image/O.gif");
img = new Image(fin);
img_view = new ImageView(img);
root.add(img_view, j, i);
}
else{
continue;
}
}
}
Scene scene = new Scene(root, 200, 200);
primaryStage.setScene(scene);
primaryStage.setTitle("Tic-Tac-Toe Board Demo");
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}