AnoTest

JavaPaintIfElse

Dec 1st, 2021
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1.  
  2.         int x = e.getX();
  3.         int y = e.getY();
  4.         if(x >= 50 &&  x<= 100 && y<= 80) {
  5.              g.drawOval(50,50,20,20);
  6.             Tableau[0][0] = 1;
  7.             System.out.println("premiere cases");
  8.         }
  9.         else if(x >=100 && x<=150 && y<=80) {
  10.             g.drawOval(100,50,20,20);
  11.             Tableau[0][1] = 1;
  12.  
  13.         }
  14.         else if(x >=150 && x<=200 && y<=80) {
  15.             g.drawOval(150,50,20,20);
  16.  
  17.         }
  18.         else if(x >=200 && x<=250 && y<=80) {
  19.             g.drawOval(200,50,20,20);
  20.  
  21.         }
  22.         else if(x >=250 && x<=300 && y<=80) {
  23.             g.drawOval(250,50,20,20);
  24.  
  25.         }
  26.         else {
  27.             System.out.println("not both");
  28.         }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment